コード例 #1
0
ファイル: RealProjectile.cs プロジェクト: Edacth/ui-sandbox
 public void Init(Vector3 _position, CARDINAL _direction, PROJTYPE _type, float _speed)
 {
     transform.position = _position;
     direction          = _direction;
     speed = _speed;
     type  = _type;
     spriteRenderer.sprite = sprites[(int)type];
 }
コード例 #2
0
ファイル: UIProjectile.cs プロジェクト: Edacth/ui-sandbox
 public void Init(Vector3 _position, CARDINAL _direction, PROJTYPE _type, float _speed)
 {
     rectTransform.position = _position;
     direction             = _direction;
     speed                 = _speed;
     type                  = _type;
     spriteRenderer.sprite = sprites[(int)type];
     transform.eulerAngles = DirectionDict.rotDict[direction];
 }
コード例 #3
0
        public void Shoot(PROJTYPE _type)
        {
            if (UIProjecile == null)
            {
                Debug.LogError("UIProjectile is null", this); return;
            }
            UIProjectile projectile = Instantiate(UIProjecile, UIController.instance.canvas.transform).GetComponent <UIProjectile>();

            projectile.Init(rectTransform.position, direction, _type, 0.1f);
        }
コード例 #4
0
        public void ShootInUI(CARDINAL _dir, PROJTYPE _type)
        {
            for (int i = 0; i < uiObjects.Count; i++)
            {
                UIShooter uiShooter = uiObjects[i] as UIShooter;

                if (uiShooter != null && uiShooter.direction == _dir)
                {
                    uiShooter.Shoot(_type);
                }
            }
        }