コード例 #1
0
    private void Attack(IEntity entity)
    {
#if UNITY_ANDROID
        if (VirtualKeyManager.IsKeyDown("shoot"))
        {
            entity.Shoot();
        }
        if (VirtualKeyManager.IsKeyDown("bomb"))
        {
            entity.SetBomb();
        }
#else
        if (Input.GetKey(_shoot[_index]))
        {
            entity.Shoot();
        }
        if (Input.GetKey(_bomb[_index]))
        {
            entity.SetBomb();
        }
#endif
    }
コード例 #2
0
    private void Move(IEntity entity)
    {
#if UNITY_ANDROID
        if (VirtualKeyManager.IsKeyDown("up"))
        {
            entity.MoveNorth();
        }
        if (VirtualKeyManager.IsKeyDown("down"))
        {
            entity.MoveSouth();
        }
        if (VirtualKeyManager.IsKeyDown("left"))
        {
            entity.MoveWest();
        }
        if (VirtualKeyManager.IsKeyDown("right"))
        {
            entity.MoveEast();
        }
#else
        if (Input.GetKey(_up[_index]))
        {
            entity.MoveNorth();
        }
        if (Input.GetKey(_dwon[_index]))
        {
            entity.MoveSouth();
        }
        if (Input.GetKey(_left[_index]))
        {
            entity.MoveWest();
        }
        if (Input.GetKey(_right[_index]))
        {
            entity.MoveEast();
        }
#endif
    }