Пример #1
0
    //////////////////////////////////////////////////////////////////////////
    // Private Methods                                                      //
    //////////////////////////////////////////////////////////////////////////
    void instanciateDog()
    {
        scr_Node node = dogSpawns[Random.Range(0, 2)];

        GameObject myDog = Instantiate(dog,
                                       node.POSITION,
                                       Quaternion.identity) as GameObject;

        scr_DogController dogCntrl = myDog.GetComponent <scr_DogController>();

        if (dogCntrl == null)
        {
            return;
        }

        m_dogCntrl = dogCntrl;
        dogCntrl.Init(node);

        Camera mainCam = Camera.main;

        if (mainCam != null)
        {
            scr_CameraFollow camFollow = mainCam.GetComponent <scr_CameraFollow>();
            if (camFollow != null)
            {
                camFollow.SetTarget(myDog.transform);
            }
        }

        return;
    }
Пример #2
0
    Init(scr_DogController _dog, scr_Node _startNode)
    {
        m_animator = GetComponent <Animator>();

        m_rb = GetComponent <Rigidbody2D>();

        m_direction = Vector3.zero;

        // Setup Start Node.
        transform.position = _startNode.POSITION;
        m_start            = _startNode;

        // Setup Dog.
        m_dog = _dog;

        m_path = new Queue <scr_Node>();

        m_fsm = new scr_fsm();
        m_fsm.Init();

        m_fsm.AddState(new Scr_miguel_calculatePath(this));
        m_fsm.AddState(new Scr_miguel_followPath(this));

        m_fsm.SetState((int)MIGUEL_STATE.CalculatePath);
        return;
    }