Exemplo n.º 1
0
    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    //{
    //
    //}

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        WolfBehaviour wolfController = GameObject.Find("wolf").GetComponent <WolfBehaviour>();

        wolfController.setSpeed(initialSpeed);
        animator.SetBool("walk", true);
    }
    private void SetupGame()
    {
        foreach (GameObject botSheep in GameObject.FindGameObjectsWithTag("SheepAgent")) // Ищем все игровые объекты и добавляем в менеджер
        {
            botList.Add(botSheep.GetComponent <BotSheepBehaviour>());
        }
        playerSheep = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerSheepBehaviour>();
        sheepAliveList.AddRange(botList);
        sheepAliveList.Add(playerSheep);
        safeZone      = GameObject.FindGameObjectWithTag("Rescue").GetComponent <SafeZoneBehaviour>();
        gameField     = GameObject.FindGameObjectWithTag("GameField");
        wolfBehaviour = GameObject.FindGameObjectWithTag("Wolf").GetComponent <WolfBehaviour>();
        uiController  = GameObject.FindGameObjectWithTag("UiController").GetComponent <UiController>();
        safeZoneScale = GameObject.FindGameObjectWithTag("Rescue").transform.localScale;

        // Обновляем статичские переменные
        GameIsOn   = true;
        turnNumber = 0;
        huntIsOn   = false;

        // На начало игры отключаем волка
        wolfBehaviour.gameObject.SetActive(false);


        Debug.Log("Game Setup Finished");
    }
Exemplo n.º 3
0
 // Use this for initialization
 void OnEnable()
 {
     agent      = GetComponent <NavMeshAgent>();
     timer      = wanderTimer;
     Anim       = GetComponent <Animator>();
     Controller = GetComponent <WolfBehaviour>();
 }
Exemplo n.º 4
0
    private void OnTriggerEnter(Collider other)
    {
        // Debug.Log(_newPosition.position);

        if (other.GetComponent <WolfBehaviour>())
        {
            WolfBehaviour wolf = other.GetComponent <WolfBehaviour>();

            Instantiate(_dragonAI, _ghostPosition);
            wolf.SetState(new SplitState(wolf, _newPosition));
        }
        else if (other.GetComponent <DragonBehaviour>())
        {
            DragonBehaviour dragon = other.GetComponent <DragonBehaviour>();

            Instantiate(_wolfAI, _ghostPosition);
            dragon.SetState(new SplitState(dragon, _newPosition));
        }
    }