Example #1
0
    protected void Start()
    {
        m_animationComponent = GetComponent <PlayerAnimation>();
        Debug.Assert(m_animationComponent != null, "Error: el componente animacion no existe");
        m_animationComponent.RegisterOnAnimationEvent = OnAnimationFinish;

        SendMessage("OnChangeWeapon", m_activeWeapon, SendMessageOptions.DontRequireReceiver);

        // TODO 1 : Registramos RegisterChangeWeapon en el input controller del inputmgr con el event ChangeWeapon
        //Cogemos el inputmgr
        InputMgr inputMgr = GameMgr.GetInstance().GetServer <InputMgr>();

        Debug.Assert(inputMgr != null, "Error: el componente InputMgr no existe");

        //Cogemos el controlador del pointAndClick
        PointAndClickInput m_pointInput = inputMgr.GetInput <PointAndClickInput>();

        Debug.Assert(m_pointInput != null, "Error: el componente PointAndClickInput no existe");

        //Registramos ChangeeWeapon en el m_pointController
        m_pointInput.RegisterChangeWeapon(this.ChangeWeapon);


        foreach (TWeapons wp in m_weapons)
        {
            wp.gameObject.SetActive(false);
        }
        m_weapons[m_activeWeapon].gameObject.SetActive(true);
        m_animationComponent.ChangeOverrideAnimatorController(m_weapons[m_activeWeapon].AnimationController);
    }