예제 #1
0
    private void Shoot(Vector2Int source, Vector2Int target)
    {
        if (Board.IsValidCellPosition(target))
        {
            GameObject obj = Board.self.GetObjectAt(target);
            if (obj != null)
            {
                Board.self.RemoveObjectAt(target);

                UnitController uc = obj.GetComponent <UnitController> ();
                if (uc != null)
                {
                    uc.Die();
                    Player.KillBird(uc);
                }
                else
                {
                    GameObject.DestroyImmediate(obj);
                }
            }

            ResetVisuals();
            animate.AnimateToRotation(Quaternion.identity, Quaternion.Euler(0f, 0f, -30), .2f, Animate.RepeatMode.OnceAndBack);
            model.pigeon.sprite = ResourceManager.self.GetPigeonSprite(playerIndex, PigeonPose.Shoot);
            Invoke("StopShoot", .5f);
            spawnDirectedVfx(shotVfx, source, target);

            ResourceManager.self.PlaySound(SFX.shot);
        }
    }