Example #1
0
 void Update()
 {
     m_PlayerController = (EnemyCharacterController)m_Character.m_Opponent;
     m_RetreatTimer    += Time.deltaTime;
     m_PredictionTimer += Time.deltaTime;
     m_PursueTimer     += Time.deltaTime;
 }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown("space"))
     {
         Debug.Log("Current scene: " + SceneManager.GetActiveScene().name);
         if (SceneManager.GetActiveScene().name == "Board_Scene")
         {
             SceneManager.LoadScene("Board_Scene_2");
             foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
             {
                 EnemyCharacterController controller = (EnemyCharacterController)enemy.GetComponent(typeof(EnemyCharacterController));
                 controller.SetLightSprite();
             }
         }
         else
         {
             SceneManager.LoadScene("Board_Scene");
             foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
             {
                 EnemyCharacterController controller = (EnemyCharacterController)enemy.GetComponent(typeof(EnemyCharacterController));
                 controller.SetDarkSprite();
             }
         }
     }
 }
Example #3
0
        void Start()
        {
            mainGameScript = FindObjectOfType <MainGameScript>();
            audioPlayer    = FindObjectOfType <AudioPlayer>();

            characterController = GetComponent <EnemyCharacterController>();

            state = EnemyState.Idle;
        }
        void Start()
        {
            renderer = GetComponent <SpriteRenderer>();

            gameScript          = GetComponent <EnemyGameScript>();
            characterController = GetComponent <EnemyCharacterController>();

            originalColor = renderer.color;
        }
    public override void Enter()
    {
        m_NextState = this;

        EnemyCharacterController enemy = (EnemyCharacterController)m_Character;

        patrolPointLeft  = enemy.patrolPointLeft;
        patrolPointRight = enemy.patrolPointRight;
    }
Example #6
0
    //run on game load (before start)
    void Awake()
    {
        //grab relevant objects to our controller.
        CharacterController = GetComponent("CharacterController") as CharacterController;
        Instance            = this;
        animator            = transform.GetComponent <Animator>();
        NavAgent            = GetComponent <NavMeshAgent>();

        //grab hearing collider instance
        hearingCollider = transform.GetComponent <SphereCollider>();
    }
Example #7
0
    private void Start()
    {
        m_EnemyCharacterController = GetComponent <EnemyCharacterController>();
        DebugUtility.HandleErrorIfNullGetComponent <EnemyCharacterController, PlayerSpellsManager>(m_EnemyCharacterController, this, gameObject);

        // Add starting Spells
        for (int i = 0; i < startingSpells.Count; i++)
        {
            SwitchToSpellIndex(startingSpells[i], i);
        }
    }
    public void updatePreviousActions(string action)
    {
        for (int i = 0; i < previousActions.Length - 1; i++)
        {
            previousActions[i] = previousActions[i + 1];
        }

        previousActions[previousActions.Length - 1] = action;

        for (int i = 0; i < predictionSequence.Length; i++)
        {
            predictionSequence[i] = previousActions[i + 1];
        }

        if (m_Opponent != null)
        {
            EnemyCharacterController enemyScript = (EnemyCharacterController)m_Opponent;

            enemyScript.nGramPredictor.RegisterSequence(previousActions);
        }
    }
Example #9
0
    public override void Init()
    {
        m_SpellManager               = selfGameObject.GetComponent <EnemySpellsManager>();
        m_SelfController             = selfGameObject.GetComponent <EnemyCharacterController>();
        m_Params                     = selfGameObject.GetComponent <StrategyParams>();
        m_SelfStats                  = selfGameObject.GetComponent <CharacterStatsController>();
        m_PlayerController           = playerGameObject.GetComponent <PlayerCharacterController>();
        m_PlayerStats                = playerGameObject.GetComponent <PlayerStatsController>();
        m_SelfStats.onHealthChanged += UpdateDamageTime;
        m_DelayBetweenAttacks        = m_SelfController.delayBetweenAttacks;
        m_cdr                = m_SelfStats.cdr.GetValue();
        m_GFX                = selfGameObject.transform.Find("GFX").gameObject;
        m_MobileHealthBar    = m_GFX.transform.Find("MobileHealthBar").gameObject;
        m_EnemyGraphic       = m_GFX.transform.Find("EnemyGraphic").gameObject;
        m_TheHangingGraphic  = m_EnemyGraphic.transform.Find("Rope").gameObject;
        m_Level              = LevelsManager.instance.level;
        m_Animator           = selfGameObject.GetComponent <EnemyAnimator>();
        m_PlayerInteractable = playerGameObject.GetComponent <InteractableBase>();

        PlayerManager.instance.playerDamageTaken += (dmg) => { m_DamageBalanced += dmg; };
        EnemyManager.instance.enemyDamageTaken   += (dmg) => { m_DamageBalanced -= dmg; };
    }
Example #10
0
 public void Enter(EnemyCharacterController parent)
 {
     this.parent = parent;
 }
Example #11
0
 void Update()
 {
     m_PlayerController = (EnemyCharacterController)m_Character.m_Opponent;
     m_RetreatTimer += Time.deltaTime;
     m_PredictionTimer += Time.deltaTime;
     m_PursueTimer += Time.deltaTime;
 }
Example #12
0
 void Start()
 {
     m_EnemyController = (EnemyCharacterController)m_Character;
     m_PlayerController = (EnemyCharacterController)m_Character.m_Opponent;
 }
Example #13
0
 private void Start()
 {
     parent = GetComponentInParent <EnemyCharacterController>();
 }
Example #14
0
 void Start()
 {
     m_EnemyController  = (EnemyCharacterController)m_Character;
     m_PlayerController = (EnemyCharacterController)m_Character.m_Opponent;
 }