public WaveHero(string heroName, string partyName, string spawnerName, float delay)
	{
		this.heroName = heroName;
		this.partyName = partyName;
		this.spawnerName = spawnerName;
		this.delay = delay;		
		
		heroInfo = new HeroInformation();
	}
 //
 void Awake()
 {
     // Makes the current instance a static one.
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     //heroInformation = Resources.Load("Script/Hero/Heroinformation", typeof(HeroInformation)) as HeroInformation;
     time            = 0;
     player          = GetComponent <Transform>();
     heroInformation = new HeroInformation();
     heroInformation.baseCharacterInformation = new BaseCharacterInformation();
     heroInformation.SetJumpSpeed(200);
     heroInformation.baseCharacterInformation.SetDamage(5);
     heroInformation.baseCharacterInformation.SetHP(100);
     heroInformation.baseCharacterInformation.SetMoveSpeed(10);
     drawBar = GameObject.Find("Canvas").GetComponent <DrawBar>();
     heroInformation.baseCharacterInformation.anim = GetComponent <Animator>();
     heroInformation.rigidbody = GetComponent <Rigidbody>();
 }
	protected void LoadHeroInfo(string heroName)
	{
		HeroInformation info = new HeroInformation();
		
		if (heroXmlDoc != null)
		{
			string UIsprite, gameName, dataName;
			float maxHealth, moveSpeed;
			int gold;
						
			XmlNode node = heroXmlDoc.SelectSingleNode("/heroes/hero[@name=\'" + heroName + "\']");
			
			UIsprite = node.SelectSingleNode("./UISprite").InnerText;
			gameName = node.SelectSingleNode("./gameName").InnerText;
			dataName = heroName;
			
			maxHealth = float.Parse(node.SelectSingleNode("./stats").SelectSingleNode("./health").InnerText);
			moveSpeed = float.Parse(node.SelectSingleNode("./stats").SelectSingleNode("./moveSpeed").InnerText);
			gold = int.Parse(node.SelectSingleNode("./gold").InnerText);
			
			info.UISpriteName = UIsprite;
			info.maxHealth = maxHealth;
			info.moveSpeed = moveSpeed;
			info.gameName = gameName;
			info.dataName = dataName;
			info.gold = gold;
		}
		
		cachedHeroInformation.Add(heroName, info);		
	}