Exemple #1
0
    void Start()
    {
        if (target == null && animation != null)
        {
            target = animation;
        }

        if (transform.parent != null)
        {
            Transform t = transform.parent;

            while (t != null && (motor == null || input == null))
            {
                if (motor == null)
                {
                    motor = t.GetComponent <RPGMotor>();
                }

                if (input == null)
                {
                    input = t.GetComponent <RPGInput>();
                }

                t = t.parent;
            }

            if (motor != null)
            {
                motor.OnJump  = new Action(OnJump);
                motor.OnLand  = new Action(OnLand);
                motor.OnFall  = new Action(OnFall);
                motor.OnIdle  = new Action(OnIdle);
                motor.OnMove  = new Action(OnMove);
                motor.OnSlide = new Action(OnSlide);
            }
        }

        if (target != null)
        {
            target.wrapMode = WrapMode.Loop;
            target.Stop();

            SetupPrioAnimation(landing);
            SetupPrioAnimation(jumping);
        }

        if (motor != null)
        {
            SetRotation(motor.transform.forward);
        }
    }
Exemple #2
0
    void Start()
    {
        if (target == null && animation != null)
        {
            target = animation;
        }

        if (transform.parent != null)
        {
            Transform t = transform.parent;

            while (t != null && (motor == null || input == null))
            {
                if (motor == null)
                {
                    motor = t.GetComponent<RPGMotor>();
                }

                if (input == null)
                {
                    input = t.GetComponent<RPGInput>();
                }

                t = t.parent;
            }

            if (motor != null)
            {
                motor.OnJump = new Action(OnJump);
                motor.OnLand = new Action(OnLand);
                motor.OnFall = new Action(OnFall);
                motor.OnIdle = new Action(OnIdle);
                motor.OnMove = new Action(OnMove);
                motor.OnSlide = new Action(OnSlide);
            }
        }

        if (target != null)
        {
            target.wrapMode = WrapMode.Loop;
            target.Stop();

            SetupPrioAnimation(landing);
            SetupPrioAnimation(jumping);
        }

        if (motor != null)
        {
            SetRotation(motor.transform.forward);
        }
    }