Esempio n. 1
0
        private void OnDeath(BaseMobileBehaviour mobile)
        {
            var levelManager = GameObject.Find("FightManager").GetComponent <LevelManager>();
            var currentLevel = levelManager.GetCurrentLevel();

            currentLevel.Reset();

            StartCoroutine(ShowDeathCanvas(2));
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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;
 }
Esempio n. 8
0
 // Start is called before the first frame update
 void Start()
 {
     useSkillButton = GetComponent <Button>();
     useSkillButton.onClick.AddListener(OnClick);
     mobile = GameObject.FindGameObjectWithTag("Player").GetComponent <BaseMobileBehaviour>();
 }
Esempio n. 9
0
 // Start is called before the first frame update
 void Start()
 {
     mobileBehaviour = gameObject.GetComponent <BaseMobileBehaviour>();
 }