Пример #1
0
        private void HandleHeroInit(HeroRecord record)
		{
			//Preload resources
			List<HeroData> dataList = heroProxy.GetAllHeroDataList();
			for (int i = 0; i < dataList.Count; ++i)
			{
				HeroData heroData = dataList[i];
				ResourceManager.Instance.PreloadAsset(ObjectType.GameObject, heroData.GetResPath());
			}
			ResourceManager.Instance.PreloadAsset(ObjectType.GameObject, "Effects/ConversionEffect");

			//Init
            if(record == null)
            {
                int heroKid = IDManager.Instance.GetID(IDType.Hero, 1);
                hero = Hero.Create(heroKid, null);

                MazeData mazeData = MazeDataManager.Instance.CurrentMazeData;
                Vector3 startPosition = MazeUtil.GetWorldPosition(mazeData.StartCol, mazeData.StartRow, mazeData.BlockSize);
                hero.SetPosition(startPosition);
            }
            else
            {
                hero = Hero.Create(record);
                hero.SetPosition(record.WorldPosition.ToVector3());
                hero.SetRotation(record.WorldAngle);
                hero.Info.IsInHall = record.IsInHall;
                hero.IsVisible = record.IsVisible;
            }
			hero.CallbackDie = OnHeroDie;

			//Battle
			BattleProxy battleProxy = ApplicationFacade.Instance.RetrieveProxy<BattleProxy>();
			battleProxy.SetHero(hero);

			//Conversion
			convertEffect = ResourceManager.Instance.LoadAsset<EffectScript>(ObjectType.GameObject, "Effects/ConversionEffect");
			convertEffect.Deactive();

			//Input
//            InputManager.Instance.SetKeyboardAction(KeyboardActionType.Attack, OnHeroAttack);
//            InputManager.Instance.SetKeyboardAction(KeyboardActionType.Function, OnHeroFunction);

            hero.Info.AddHP(999999);
		}
Пример #2
0
 public new HeroRecord ToRecord()
 {
     HeroRecord record = new HeroRecord();
     record.Uid = Uid;
     record.Kid = Data.Kid;
     record.WorldPosition = new Vector3Record(WorldPosition);
     record.WorldAngle = WorldAngle;
     record.IsVisible = IsVisible;
     record.IsInHall = Info.IsInHall;
     record.HP = Info.HP;
     return record;
 }
Пример #3
0
 public static Hero Create(HeroRecord record)
 {
     HeroData data = HeroDataManager.Instance.GetData(record.Kid) as HeroData;
     HeroInfo info = new HeroInfo(data, record);
     return Create(record.Kid, info);
 }
Пример #4
0
 public HeroInfo (HeroData data, HeroRecord record) : base(data)
 {
     Data = data;
     hp = record.HP;
     IsInHall = record.IsInHall;
 }