public void camouflageInRange()
 {
     camouflage = playerActor.GetComponent <CamouflageController>();
     if (camouflage != null)
     {
         camouflage.EnemyInRange(this.gameObject);
         // Debug.Log("Can't camouflage!");
     }
 }
        protected override IActorState GetNextState()
        {
            if (!Actor.GetComponent <ActorHealth>().IsAlive)
            {
                return(new DeathState(Actor));
            }

            return(Mobile.CheckGround()
                ? (IActorState) new GroundedState(Actor)
                : new FallState(Actor));
        }
Example #3
0
        protected override IActorState GetNextState()
        {
            if (!_actor.GetComponent <ActorHealth>().IsAlive)
            {
                return(new DeathState(_actor));
            }

            if (_teleportToCheckpointOnComplete)
            {
                CheckpointManager.TeleportPlayerToLastCheckpoint();
                return(new PauseState());
            }

            return(_actor.Mobile.CheckGround()
                ? (IActorState) new GroundedState(_actor)
                : new FallState(_actor));
        }
    //----------------------------

    private void Awake()
    {
        m_enemyInteractable = GetComponent <EnemyInteractable>();
        audioSource         = GetComponent <AudioSource>();
        playerActor         = GameObject.FindObjectOfType <PlayerActor>();
        wantedLevel         = GameObject.FindObjectOfType <WantedLevel>();

        chaseState          = new ChaseState(this);
        alertState          = new AlertState(this);
        patrolState         = new PatrolState(this);
        m_caughtPlayerState = new CaughtPlayerState(this);

        navMeshAgent       = GetComponent <NavMeshAgent>();
        navMeshAgent.speed = standartSpeed;

        enemyAnimator    = GetComponent <Animator>();
        elephantMovement = playerActor.GetComponent <ElephantMovement>();

        if (wayPoints == null)
        {
            wayPoints = new Waypoints()
            {
                points = new[] { transform.position },
                pairs  = new[] { new Pair() }
            }
        }
        ;
    }

    void OnValidate()
    {
        currentState = patrolState;
    }

    void Start()
    {
        currentState = patrolState;

        viewCone.MainViewRadius = toleratedSightrange;
        viewCone.FullViewRadius = sightRange;
        viewCone.FieldOfView    = fieldOfView;

        OnCaught += StatePatternEnemy_OnCaught;
    }
Example #5
0
    private void GiveUpgrade(PlayerActor player)
    {
        _onPickUpCue?.Play();
        // Get weapons
        WeaponsController playerWeapons = player.GetComponent <WeaponsController>();

        if (Hand)
        {
            playerWeapons.Right.UpgradeWeapon(_rightWeaponUpgrade);
        }
        else
        {
            playerWeapons.Left.UpgradeWeapon(_leftWeaponUpgrade);
        }


        Active = false;
        _upgradeParticleSystem?.gameObject.SetActive(false);
    }