private void OnDeath(BaseMobileBehaviour mobile) { var levelManager = GameObject.Find("FightManager").GetComponent <LevelManager>(); var currentLevel = levelManager.GetCurrentLevel(); currentLevel.Reset(); StartCoroutine(ShowDeathCanvas(2)); }
private void OnEnemyDeath(BaseMobileBehaviour enemy) { numberOfDeaths++; IsFinished = numberOfDeaths >= Enemies.Count; var enemyLevel = enemy.GetComponent <MobileLevel>(); if (playerLevel == null) { playerLevel = GameObject.FindGameObjectWithTag("Player").GetComponent <MobileLevel>(); } playerLevel.GainExperience(enemyLevel.TotalExperienceGained); TotalXPGainedFromEnemies += enemyLevel.TotalExperienceGained; }
void InitGame() { if (AppManager.Instance == null || AppManager.Instance.IsRanged) { ArcherCharacter.SetActive(true); selectedCharacter = ArcherCharacter.GetComponent <BaseMobileBehaviour>(); ActionButton.GetComponent <Image>().sprite = RangedImage; } else { MeleeCharacter.SetActive(true); selectedCharacter = MeleeCharacter.GetComponent <BaseMobileBehaviour>(); ActionButton.GetComponent <Image>().sprite = MeleeImage; } playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <HealthBehaviour>(); playerHealth.OnHealthBelowZeroEvent += new HealthBehaviour.OnHealthBelowZeroEventHandler(OnDeath); }
public void Disable(BaseMobileBehaviour mobileBehaviour) { IsActive = false; List <Component> effects = new List <Component>(); mobileBehaviour.gameObject.GetComponents(typeof(BaseAbillityEffect), effects); foreach (BaseAbillityEffect effect in effects) { effect.OnBeforeDestroy(); Destroy(effect); } if (instantiatedParticleEffect != null) { Destroy(instantiatedParticleEffect); } //Debug.Log("finished " + Name); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { AIBehaviour = animator.GetComponent <AIMovementBehaviour>(); MobileBehaviour = animator.GetComponent <BaseMobileBehaviour>(); MobileHealth = animator.GetComponent <HealthBehaviour>(); var playerObj = GameObject.FindGameObjectWithTag("Player"); if (playerObj != null) { PlayerBehaviour = playerObj.GetComponent <PlayerBehaviour>(); DeltaVector = MobileBehaviour.transform.position - PlayerBehaviour.transform.position; } if (MobileBehaviour.WeaponBehaviour != null) { animator.SetBool("IsRanged", MobileBehaviour.WeaponBehaviour.IsRanged); animator.SetFloat("AttackDistance", MobileBehaviour.WeaponBehaviour.AttackDistance); } animator.SetFloat("Health", MobileHealth.Health); animator.SetFloat("ChaseDistance", MobileBehaviour.ChaseDistance); animator.SetFloat("FleeBelowHealth", MobileBehaviour.FleeBelowHealth); animator.SetFloat("FleeDistance", MobileBehaviour.FleeDistance); }
public BaseAbillity Use(BaseMobileBehaviour mobileBehaviour) { if (!IsActive) { IsActive = true; //Debug.Log("active " + Name); foreach (var effect in Effects) { mobileBehaviour.gameObject.AddComponent(effect.GetType()); } if (ParticleEffect != null) { instantiatedParticleEffect = Instantiate(ParticleEffect, Vector3.zero, Quaternion.identity); instantiatedParticleEffect.transform.SetParent(mobileBehaviour.WeaponBehaviour.transform); instantiatedParticleEffect.transform.position = Vector3.zero; instantiatedParticleEffect.transform.localPosition = Vector3.zero; } return(this); } return(null); }
void Start() { //Debug.Log("set damage amplifier"); mobileBehaviour = GetComponent<BaseMobileBehaviour>(); mobileBehaviour.WeaponBehaviour.Damage = mobileBehaviour.WeaponBehaviour.Damage * AmplifyValue; }
// Start is called before the first frame update void Start() { useSkillButton = GetComponent <Button>(); useSkillButton.onClick.AddListener(OnClick); mobile = GameObject.FindGameObjectWithTag("Player").GetComponent <BaseMobileBehaviour>(); }
// Start is called before the first frame update void Start() { mobileBehaviour = gameObject.GetComponent <BaseMobileBehaviour>(); }