//------------------------------------------------------------------------------------------------------------------ public void UseShoutSkill(Combat.IMediator mediator) { m_skill_6.UseSkill(true); UNIT_ISoldier soldier = this; soldier.DoShoutSkillBehaviour(mediator); }
//------------------------------------------------------------------------------------------------------------------ public void UseHeavenSpinSKill(Combat.IMediator mediator) { m_skill_7.UseSkill(true); UNIT_ISoldier soldier = this; soldier.DoHeavenSpinSkillBehaviour(mediator); }
//------------------------------------------------------------------------------------------------------------------ public void UseInvencibleShieldSkill(Combat.IMediator mediator) { m_skill_4.UseSkill(true); UNIT_ISoldier soldier = this; soldier.DoInvencibleShieldSkillBehaviour(mediator); }
//------------------------------------------------------------------------------------------------------------------ public void UseLeapOfFaithSkill(Combat.IMediator mediator) { m_skill_5.UseSkill(true); UNIT_ISoldier soldier = this; soldier.DoLeapOfFaithSkillBehaviour(mediator); }
//------------------------------------------------------------------------------------------------------------------ public void UseBlindTortureSkill(Combat.IMediator mediator) { m_skill_3.UseSkill(true); UNIT_ISoldier soldier = this; soldier.DoBlindTortureSkillBehaviour(mediator); }
//------------------------------------------------------------------------------------------------------------------ public HeroImpactSliceSkill(UNIT_ISoldier hero) { this.m_hero = hero; this.m_damage = m_hero.GetDamage(); this.m_damageMultiplier = 1.1f; this.m_attackSpeed = m_hero.GetAtackSpeed(); this.m_attackSpeedMultiplier = 1.1f; }
//------------------------------------------------------------------------------------------------------------------ public void UseImpactSliceSkill(Combat.IMediator mediator) { m_skill_2.UseSkill(true); //m_skill_2 UNIT_ISoldier soldier = this; soldier.DoImpactSliceSkillBehaviour(mediator); }
//------------------------------------------------------------------------------------------------------------------ void UNIT_ISoldier.Update(Combat.IMediator mediator) { UNIT_ISoldier hero = this; //lock camera on player movement GameObject.Find("GAMEOBJ_Dummy").transform.position = this.m_heroGameObject.transform.position; //activate Runner skill if (GameSystem.HeroControl.RightMouseClickDown()) { this.UseRunnerSkill(); } m_skill_1.UpdateSkill(); m_skill_2.UpdateSkill(); m_skill_3.UpdateSkill(); m_skill_4.UpdateSkill(); m_skill_5.UpdateSkill(); m_skill_6.UpdateSkill(); m_skill_7.UpdateSkill(); //keep player at NavigationMesh if (GameSystem.HeroControl.LeftMouseClick()) { if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out m_hitPosition, 100)) { //if (hitPosition.collider.gameObject.tag == "NavigationMesh") { hero.MoveTo(m_hitPosition.point); } } } //keep walking until character reach hitPosition Vector3 position = hero.GetPosition(); if (Vector3.Distance(position, m_hitPosition.point) <= 0.2f) { hero.SetState((int)Combat.HeroStates.HERO_IDLE); } else { hero.SetState((int)Combat.HeroStates.HERO_RUN); } //messages to mediator mediator.DistributeMessageHeroPosition(this); }
//------------------------------------------------------------------------------------------------------------------ public HeroRunnerSkill(UNIT_ISoldier hero) { this.m_hero = hero; this.m_movementSpeed = m_hero.GetMovementSpeed(); this.m_movementSpeedMultiplier = 3.0f; this.m_animatorSpeed = m_hero.GetAnimatorSpeed(); this.m_animatorSpeedMultiplier = this.m_movementSpeedMultiplier; this.m_skillEndTime = 5.0f; //rules to use this skill this.m_minCoolDown = 3.0f; this.m_manaCost = 0; this.m_currentTimeInSeconds = Time.time; this.m_lastTimeInSeconds = this.m_currentTimeInSeconds; this.m_skillCurrentTime = 0; }
//------------------------------------------------------------------------------------------------------------------ // void IMediator.AdviceForMonsterAttack(UNIT_ISoldier attacker, int damage) // { // for (int i = soldierAliveList.Count-1; i >= 0 ; i--){ // UNIT_ISoldier soldier = soldierAliveList[i]; // // if(soldier.GetType() == typeof(UNIT_Hero)) // { // Debug.Log("im a hero"); // } // // if (soldier != attacker){ // soldier.ReceiveAttack(damage); // soldier.SetMaterialEmissionDamage(); // //move to dead list // if(soldier.IsDead()){ // soldierDeadList.Add(soldier); // soldierAliveList.Remove(soldier); // } // } // } // } //------------------------------------------------------------------------------------------------------------------ void IMediator.DistributeMessageHeroPosition(UNIT_ISoldier hero) { Vector3 heroPosition = hero.GetPosition(); Vector3 enemyPosition = Vector3.zero; for (int i = 0; i < m_soldierList.Count; i++) { UNIT_ISoldier soldier = m_soldierList[i]; //check if is not the player if (soldier != hero) { enemyPosition = soldier.GetPosition(); float distance = Vector3.Distance(heroPosition, enemyPosition); //chase hero UNIT_Enemy enemy = (UNIT_Enemy)soldier; float visionRadius = enemy.GetVisionRadius(); if (distance <= visionRadius) { soldier.MoveTo(heroPosition); } } } }
//------------------------------------------------------------------------------------------------------------------ public HeroHeavenSpinSKill(UNIT_ISoldier hero) { this.m_hero = hero; }
//------------------------------------------------------------------------------------------------------------------ public HeroShoutSkill(UNIT_ISoldier hero) { this.m_hero = hero; }
//------------------------------------------------------------------------------------------------------------------ public HeroLeapOfFaithSkill(UNIT_ISoldier hero) { this.m_hero = hero; }
//------------------------------------------------------------------------------------------------------------------ public HeroBlindTortureSkill(UNIT_ISoldier hero) { this.m_hero = hero; }
//------------------------------------------------------------------------------------------------------------------ public HeroInvencibleShieldSkill(UNIT_ISoldier hero) { this.m_hero = hero; }
//private List<UNIT_ISoldier> soldierAliveList = new List<UNIT_ISoldier>(); //private List<UNIT_ISoldier> soldierDeadList = new List<UNIT_ISoldier>(); //------------------------------------------------------------------------------------------------------------------ //List<UNIT_ISoldier> IMediator.soldierList{ // get { return soldierAliveList; } //} ////------------------------------------------------------------------------------------------------------------------ //List<UNIT_ISoldier> IMediator.soldierDeadList{ // get { return soldierAliveList; } //} //------------------------------------------------------------------------------------------------------------------ void IMediator.RegisterSoldier(UNIT_ISoldier soldier) { m_soldierList.Add(soldier); }