-
-
Save alucard55/91e78c0488e84ccafa5aa183857d1686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; //Last 3 for Serialization | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.IO; | |
[System.Serializable] | |
public class GuardA : Monobehaviour { | |
private StandardPlayerParadigm profile; | |
private Mercenary job; | |
private GuardPrototype type; | |
// Use this for initialization | |
void Start () { | |
profile = new StandardPlayerParadigm (); | |
job = new Mercenary (); | |
type = new GuardPrototype (); | |
//decl the stats | |
profile.Name = "Guard A"; | |
profile.stdType = type.stdType; //Which child of StandardType? | |
profile.Profession = job.Job; //Class | |
profile.ProfessionDescription = job.JobDescription; //ClassDescription | |
profile.Level = 1; | |
profile.Health = type.Health; | |
profile.Mana = type.Mana; | |
profile.TP = type.TP; | |
profile.Attack = type.Attack; | |
profile.Defense = type.Defense; | |
profile.MagicAttack = type.MagicAttack; | |
profile.MagicDefense = type.MagicDefense; | |
profile.Critical = type.Critical; | |
profile.Dexterity = type.Dexterity; | |
profile.HitRate = type.HitRate; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[System.Serializable] | |
public class GuardPrototype : StandardParadigm{ | |
//This is a Standard type. To be inherited by guards. | |
public GuardPrototype() | |
{ | |
stdType = "Royal Guard"; | |
Health = 20f; | |
Mana = 0f; //for now | |
TP = 0f; //for now | |
Attack = 12f; | |
Defense = 6f; | |
MagicAttack = 3f; | |
MagicDefense = 5f; | |
Critical = .03f; | |
Dexterity = 0f; //for now | |
HitRate = .7f; //for now | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[System.Serializable] | |
public class JobParadigm: MonoBehaviour { | |
public string Job; | |
public string JobDescription; | |
//To be added: Weapon/Armor shit | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[System.Serializable] | |
public class Mercenary : JobParadigm { | |
public Mercenary() | |
{ | |
Job = "Mercenary"; | |
JobDescription = "Made a living out of it -- must be good at it!"; | |
//To be added: Weapon/Armor uniques | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[System.Serializable] | |
public class StandardParadigm : TypeParadigm { | |
//Stats present in TypeParadigm | |
//Standard Character Child Classes have no buffs to any stat | |
public string stdType; //I.e. GuardPrototype, ScholarPrototype, etc | |
//To be added: Passive Innate Standard Abilities | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[System.Serializable] | |
public class StandardPlayerParadigm : StandardParadigm{ | |
//This is what a Standard character has, see StandardParadigm for more inherited variables. | |
public string Name; | |
public int Level; | |
public string Profession; | |
public string ProfessionDescription; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
[System.Serializable] | |
public class TypeParadigm { | |
//Stats controlled by Type: Chosen, Standard, Muted | |
//Muted gets no Mana/Magic Attack | |
public string Type; | |
//Stats are largely controlled by type | |
public float Health; | |
public float Mana; | |
public float TP; //Tech Points | |
public float Attack; | |
public float Defense; | |
public float MagicAttack; | |
public float MagicDefense; | |
public float Critical; | |
public float Dexterity; //Speed | |
public float HitRate; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Xml.Serialization; | |
public class XMLSerialization : MonoBehaviour { | |
public List <GuardA> guardPrototypeA; | |
public string path; | |
void Update() | |
{ | |
if(Input.GetKeyDown(KeyCode.S)) | |
{ | |
SaveToXML (guardPrototypeA); | |
} | |
if(Input.GetKeyDown(KeyCode.L)) | |
{ | |
guardPrototypeA = LoadFromXML<List <GuardA>> (); | |
} | |
} | |
void SaveToXML (object obj, bool appendFile = false) | |
{ | |
var serializer = new XmlSerializer (obj.GetType()); | |
using (var stream = new StreamWriter (Application.dataPath + path, appendFile)) | |
{ | |
serializer.Serialize (stream, obj); | |
} | |
} | |
T LoadFromXML <T>() | |
{ | |
var serializer = new XmlSerializer (typeof(T)); | |
using (var stream = new StreamReader (Application.dataPath + path)) | |
{ | |
object obj = serializer.Deserialize (stream); | |
return (T)obj; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment