Пример #1
0
    void Start()
    {
        //Sets the goal position as the current position.
        p_goal = transform.position;

        //Gets the BarrierDetectioCollider.
        p_barrierDetectionCollider = gameObject.GetChild("BarrierDetectionCollider");

        //Sets the actions for OnTriggerEnter and OnTriggerExit.
        RemoteCollider2DEventController collider = p_barrierDetectionCollider.GetComponent <RemoteCollider2DEventController>();

        collider._onTriggerEnter2D += WayLocked;
        collider._onTriggerExit2D  += WayUnlocked;

        //Sets the remaining time between min and max.
        p_remainingTime = Random.Range(p_minTime, p_maxTime);

        //Gets the enemy animator.
        p_animator = GetComponent <Animator>();

        //Sets the available directions.
        p_directions = new List <Vector3>()
        {
            new Vector3(0, 0, 0),
            new Vector3(0, 0, 90),
            new Vector3(0, 0, 180),
            new Vector3(0, 0, 270)
        };
    }
    void Start()
    {
        //Sets the goal position as the current position.
        p_goal = transform.position;

        //Gets the BarrierDetectioCollider.
        p_barrierDetectionCollider = gameObject.GetChild("BarrierDetectionCollider");

        //Sets the actions for OnTriggerEnter and OnTriggerExit.
        RemoteCollider2DEventController collider = p_barrierDetectionCollider.GetComponent <RemoteCollider2DEventController>();

        collider._onTriggerEnter2D += WayLocked;
        collider._onTriggerExit2D  += WayUnlocked;

        //Gets the GameObject of the Collider that is instantiated when the player attacks.
        p_photoAtackCollider = gameObject.GetChild("PhotoAttackCollider");
        p_photoAtackCollider.SetActive(false);
    }