コード例 #1
0
    void Update()
    {
        if (shipIndex == PlayManager.thisIsPlayer)
        {
            if (Input.GetKeyDown("up") && gameObject.transform.position.y < 4)
            {
                up();
                PlayManager.Control("up");
            }
            if (Input.GetKeyDown("down") && gameObject.transform.position.y > -4)
            {
                down();
                PlayManager.Control("down");
            }
            if (Input.GetKeyDown("left") && gameObject.transform.position.x > -8)
            {
                left();
                PlayManager.Control("left");
            }
            if (Input.GetKeyDown("right") && gameObject.transform.position.x < 8)
            {
                right();
                PlayManager.Control("right");
            }

            if (Input.GetKeyDown("space"))
            {
                Fire();
                PlayManager.Control("space");
            }
        }

        if (Health < 1)
        {
            PlayManager.Death(shipIndex);
            gameObject.SetActive(false);
        }
    }