// Instantiate on player when walked over
        void OnTriggerEnter(Collider other)
        {
            //refactor
            //  print(other.gameObject.name);
            if (other.gameObject.GetComponent <PlayerControl>())
            {
                playerStats = other.gameObject.GetComponent <PlayerStats>();
                //maybe refactor this out so it can be called here and when player starts up.
                playerStats.LevelUpStamina(-armourStatsConfig.WeaponSlotEquipped.GetStamina());
                playerStats.LevelUpEnergy(-armourStatsConfig.WeaponSlotEquipped.GetEnergy());
                playerStats.LevelUpMentalAgi(-armourStatsConfig.WeaponSlotEquipped.GetMentalAgility());
                playerStats.LevelUpStrength(-armourStatsConfig.WeaponSlotEquipped.GetStrength());
                playerStats.LevelUpHit(-armourStatsConfig.WeaponSlotEquipped.GetHit());
                playerStats.LevelUpArmour(-armourStatsConfig.WeaponSlotEquipped.GetArmourValue());

                weaponSystem = other.gameObject.GetComponent <WeaponSystem>();
                weaponSystem.PutWeaponInHand(weaponConfig[randomItem]);//equip weapon in weaponSystem

                playerStats.LevelUpStamina(armourStatsConfig.WeaponSlotEquipped.GetStamina());
                playerStats.LevelUpEnergy(armourStatsConfig.WeaponSlotEquipped.GetEnergy());
                playerStats.LevelUpMentalAgi(armourStatsConfig.WeaponSlotEquipped.GetMentalAgility());
                playerStats.LevelUpStrength(armourStatsConfig.WeaponSlotEquipped.GetStrength());
                playerStats.LevelUpHit(armourStatsConfig.WeaponSlotEquipped.GetHit());
                playerStats.LevelUpArmour(armourStatsConfig.WeaponSlotEquipped.GetArmourValue());


                audioSource.PlayOneShot(pickUpAudioClip);
                Destroy(gameObject, pickUpAudioClip.length);
            }
        }
Beispiel #2
0
        void Start()
        {
            weaponSystem   = GetComponent <WeaponSystem>();
            healthSystem   = GetComponent <HealthSystem>();
            specialAbility = GetComponent <SpecialAbilities>();

            SetUpEnemyStats();
        }
Beispiel #3
0
 void Start()
 {
     weaponSystem = GetComponent <WeaponSystem>();
     character    = GetComponent <Character>();
     abilities    = GetComponent <SpecialAbilities>();
     animator     = GetComponent <Animator>();
     healthSystem = GetComponent <HealthSystem>();
     RegisterForMouseEvents();
 }
Beispiel #4
0
        void Update()
        {
            // print(target);
            weaponSystem       = GetComponent <WeaponSystem>();
            currentWeaponRange = weaponSystem.UpdateCurrentWeapon.GetMaxAttackRange();

            if (target != null && target.gameObject.tag != ("Animal"))
            {
                distanceToEnemy      = Vector3.Distance(target.transform.position, transform.position);
                isInWeaponCircle     = distanceToEnemy <= currentWeaponRange;
                isInChaseCircle      = (distanceToEnemy > currentWeaponRange && distanceToEnemy <= chaseRadius);
                isOutsideChaseCircle = distanceToEnemy > chaseRadius;
            }
            else if (target == null)
            {
                isOutsideChaseCircle = true;
                isInWeaponCircle     = false;
                isInChaseCircle      = false;
            }

            if (isOutsideChaseCircle)
            {
                weaponSystem.StopAttacking();
                StartCoroutine(Patrol());
            }

            if (isInChaseCircle)
            {
                StopAllCoroutines();
                float animatorForwardCap = 1f;
                character.SetAnimatorForwardCap(animatorForwardCap);
                weaponSystem.StopAttacking();
                StartCoroutine(ChaseTarget());
            }
            else if (!isInWeaponCircle && !isInChaseCircle)
            {
                float animatorForwardCap = 0.5f;
                character.SetAnimatorForwardCap(animatorForwardCap);
            }

            if (isInWeaponCircle)
            {
                if (weaponSystem)
                {
                    weaponSystem.AttackTarget(target.gameObject);
                }
                StartCoroutine(PatrolWaitWhenAttacking());
            }
        }
Beispiel #5
0
        private void Awake()
        {
            PlayerPrefs.DeleteAll();
            playerXp       = GetComponent <PlayerXP>();
            weaponSystem   = GetComponent <WeaponSystem>();
            healthSystem   = GetComponent <HealthSystem>();
            specialAbility = GetComponent <SpecialAbilities>();

            uidDisplay = GameObject.Find("Game Canvas/PlayerStatsDisplay");

            PlayerIsAlive = true;
            if (PlayerPrefs.HasKey(levelKey))
            {
                LoadStatsFromPlayerPrefs();
            }
            SortPlayerStats();
            healthSystem.SethealthBarText();
            specialAbility.SetEergyBarText();
        }