public override void Use(VoxObject target)
    {
        var newBomb = Instantiate(nuclearBomb);

        newBomb.transform.position = transform.position;
        //newBomb.transform.position = spawnPosition.position;
        base.Use(target);
    }
    void PlaceOffscreen(Vector3 screenpos, VoxObject target)
    {
        float x = screenpos.x;
        float y = screenpos.y;

        //스크린 뒤로 넘어가면
        //2D 라 이건 필요없다.

        /*if (screenpos.z < 0)
         * {
         *  screenpos = -screenpos;
         * }*/

        //x 좌표가 오른쪽을 넘어가면
        if (screenpos.x > Screen.width)
        {
            x = Screen.width - offset;
        }
        //x좌표가 왼족을 넘어가면
        if (screenpos.x < 0)
        {
            x = offset;
        }
        //y좌표 위쪽을 넘어가면
        if (screenpos.y > Screen.height)
        {
            y = Screen.height - offset;
        }
        //y좌표 아래쪽을 넘어가면
        if (screenpos.y < 0)
        {
            y = offset;
        }


        var ind = CreateIndicator(target);

        ind.rectTransform.position = new Vector3(x, y, 0);

        //화살표들의 각도는 화면 중간을 중심으로 정해져야함
        //그러나 screen pos들은 Bottom left를 중심으로 되어있음.
        //그러므로 보간해줘야함.
        Vector3 screenCenter = new Vector3(Screen.width, Screen.height, 0) / 2;
        float   angle        = Mathf.Atan2(screenCenter.y - screenpos.y, screenCenter.x - screenpos.x);

        //angle -= 90 * Mathf.Deg2Rad;

        ind.rectTransform.localRotation = Quaternion.Euler(0, 0, angle * Mathf.Rad2Deg);
    }
Пример #3
0
    public override void Use(VoxObject target)
    {
        var playerController = target.GetComponentInParent <PlayerAirplaneController>();
        var gunMng           = playerController.GunManager;

        if (gunMng.guns[1].gameObject.activeSelf == false)
        {
            gunMng.guns[1].gameObject.SetActive(true);
        }
        else if (gunMng.guns[2].gameObject.activeSelf == false)
        {
            gunMng.guns[2].gameObject.SetActive(true);
        }

        base.Use(target);
    }
    private Image CreateIndicator(VoxObject target)
    {
        Image ind;

        if (target.CompareTag("Enemy"))
        {
            ind = Instantiate(enemyImage, canvas.transform);
        }
        else
        {
            ind = Instantiate(itemImage, canvas.transform);
        }


        indicators.Add(ind);

        return(ind);
    }
 private void GiveDamageByReductionRate(VoxObject other, float reduction)
 {
     other.HP -= centerDamage * reduction;
 }
Пример #6
0
 public virtual void Use(VoxObject target)
 {
     PlaySound();
     VoxDestroy();
 }
Пример #7
0
 public override void Use(VoxObject target)
 {
     target.HP += healthIncreasePoint;
     base.Use(target);
 }