示例#1
0
 public void ResetEnemyWeapon()
 {
     enemyRangeWeapon.SetCurrentRangeWeapon(WeaponPowerupController.GameWeapons.None);
     enemyMeleeWeapon.SetCurrentMeleeWeapon(WeaponPowerupController.GameWeapons.Punch);
     typeOfAttack            = EnemyAttackType.Melee;
     _currentBehaviourTypeAI = EnemyAIMovementBehaviourType.SeekPlayerMeele;
 }
示例#2
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        _roamPosition = new GameObject().transform;

        _seeker = this.GetComponent <Seeker>();
        _currentBehaviourTypeAI = initialBehaviourTypeAI;

        if (_currentBehaviourTypeAI == EnemyAIMovementBehaviourType.Patrol)
        {
            _currentTarget = target[_currentPatrolWaypoint];

            StartCoroutine(UpdatePath());
        }
        else if (_currentBehaviourTypeAI == EnemyAIMovementBehaviourType.Roam)
        {
            PickRoamPoint();
        }

        SetAnimationState(GameActorAnimationStates.Idle);

        enemyMeleeWeapon.SetCurrentMeleeWeapon(startingMeleeWeapon);
        enemyRangeWeapon.SetCurrentRangeWeapon(startingRangeWeapon);
    }
示例#3
0
    /// <summary>
    /// Launches a raycast to try and find if the player is nearby
    /// </summary>
    private void PlayerSensor()
    {
        if (_currentBehaviourTypeAI != EnemyAIMovementBehaviourType.SeekPlayerMeele && _currentBehaviourTypeAI != EnemyAIMovementBehaviourType.SeekPlayerRange)
        {
            Debug.DrawRay(spritesBodyContainer.transform.position, spritesBodyContainer.transform.right, Color.green);

            RaycastHit2D hit = Physics2D.Raycast(spritesBodyContainer.transform.position, spritesBodyContainer.transform.right * playerSensorRange, playerSensorRange, raycastCheckLayers);
            if (hit.collider != null)
            {
                Debug.DrawRay(spritesBodyContainer.transform.position, spritesBodyContainer.transform.right, Color.yellow);
                if (hit.collider.tag == "Player")
                {
                    Debug.DrawRay(spritesBodyContainer.transform.position, spritesBodyContainer.transform.right, Color.red);
                    StopAllCoroutines();
                    _isWaitingAtWaypoint = false;
                    if (typeOfAttack == EnemyAttackType.Melee)
                    {
                        _currentBehaviourTypeAI = EnemyAIMovementBehaviourType.SeekPlayerMeele;
                    }
                    else if (typeOfAttack == EnemyAttackType.Range)
                    {
                        _currentBehaviourTypeAI = EnemyAIMovementBehaviourType.SeekPlayerRange;
                    }

                    _currentTarget = hit.collider.gameObject.transform;
                    StartCoroutine(UpdatePath());
                }
            }
        }
    }