Пример #1
0
    // Update is called once per frame
    void Update()
    {
        aniSprite Animator = GetComponent <aniSprite>();

        //***********************************animation**************************
        //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond

        Animator.Animate(2, 1, 0, 0, 2, 1);
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        aniSprite Animator = GetComponent <aniSprite>();

        //***********************************animation**************************
        //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond
        if (this.transform.position.x < calis.transform.position.x)
        {
            Animator.Animate(columns, rows, colst1, rowst1, 1, 1);
        }
        else
        {
            Animator.Animate(columns, rows, colst2, rowst2, 1, 1);
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        Calis     otherScript = calencals.GetComponent <Calis>();
        aniSprite Animator    = GetComponent <aniSprite>();

        //***********************************animation**************************
        //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond
        if (otherScript.pjedestalactive)
        {
            Animator.Animate(2, 1, 1, 0, 1, 1);
        }
        else
        {
            Animator.Animate(2, 1, 0, 0, 1, 1);
        }
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        Calis     otherScript = calencals.GetComponent <Calis>();
        aniSprite Animator    = GetComponent <aniSprite>();

        //***********************************animation**************************
        //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond
        if (otherScript.rocketActive)
        {
            Animator.Animate(2, 1, 0, 0, 1, 1);
        }
        else
        {
            Animator.Animate(2, 1, 1, 0, 1, 1);
            CameraFade.StartAlphaFade(Color.white, false, 4f, 4f, () => { Application.LoadLevel(2); });
        }
    }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        aniSprite Animator = GetComponent <aniSprite>();

        if (Input.GetKey(KeyCode.D))
        {
            turn = 1;
        }
        if (Input.GetKey(KeyCode.A))
        {
            turn = 0;
        }


        //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond

        Animator.Animate(2, 1, turn, 0, 1, 1);
    }
Пример #6
0
    void Start()
    {
        lifeBar = transform.Find("lifeBar");
        controller = GetComponent<CharacterController>();
        colliderBox = GetComponent<BoxCollider>();
        controller.isTrigger = false;

        state = PlayerState.Normal;

        ani = GetComponent<aniSprite>();

        if (this.gameObject.tag == "Player1") {
            horizontalKey = "Horizontal";
         			verticalKey = "Vertical";
            jumpKey = "Jump";
         			dashKey = "Dash";

        } else if (this.gameObject.tag == "Player2") {
            horizontalKey = "Horizontal2";
            jumpKey = "Jump2";
         			verticalKey = "Vertical2";
         			dashKey = "Dash2";
        }
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        audiowait = audiowait + Time.deltaTime;



        aniSprite Animator = GetComponent <aniSprite>();

        if (Input.GetKey(KeyCode.W))
        {
            if (IsGrounded())
            {
                GetComponent <Rigidbody>().AddRelativeForce(0, jumpForce, 0);
                GetComponent <AudioSource>().PlayOneShot(jump);
            }
        }

        if (Input.GetKey(KeyCode.W))
        {
            if (inSpace)
            {
                GetComponent <Rigidbody>().AddRelativeForce(0, 0.4f, 0);
            }
        }


        if (Input.GetKey(KeyCode.S))
        {
            if (inSpace)
            {
                GetComponent <Rigidbody>().AddRelativeForce(0, -0.4f, 0);
            }
        }

        if (Input.GetKey(KeyCode.D))
        {
            if (inSpace)
            {
                transform.Rotate(Vector3.forward * Time.deltaTime * -30);
            }
            else
            {
                transform.Translate(Vector3.right * Time.deltaTime * 5);
                //***********************************animation**************************
                //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond

                Animator.Animate(4, 4, 0, 0, 3, 12);
            }
        }

        if (Input.GetKey(KeyCode.A))
        {
            if (inSpace)
            {
                transform.Rotate(Vector3.forward * Time.deltaTime * 30);
            }
            else
            {
                //***********************************animation**************************
                //int columnSize, int rowSize, int colFrameStart, int rowFrameStart, int totalFrames, int framesPerSecond

                Animator.Animate(4, 4, 0, 1, 3, 12);
                transform.Translate(Vector3.left * Time.deltaTime * 5);
            }
        }

        //teleport for space.
        if (this.transform.position.x > 50)
        {
            transform.position = new Vector3(-39, this.transform.position.y, 0);
        }
        if (this.transform.position.x < -40)
        {
            transform.position = new Vector3(49, this.transform.position.y, 0);
        }
        if (this.transform.position.y > 30)
        {
            transform.position = new Vector3(this.transform.position.x, -34, 0);
        }
        if (this.transform.position.y < -35)
        {
            transform.position = new Vector3(this.transform.position.x, 29, 0);
        }



        //walking sound
        if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.D))
        {
            GetComponent <AudioSource>().clip = step;
            GetComponent <AudioSource>().Play();
        }

        if (Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.D))
        {
            GetComponent <AudioSource>().clip = step;
            GetComponent <AudioSource>().Stop();
        }
    }