Danmaku_no_Kyojin.BulletEngine.Bullet.GetAimDir C# (CSharp) Method

GetAimDir() public method

Get the direction to aim that bullet
public GetAimDir ( ) : float
return float
        public float GetAimDir()
        {
            //get the player position so we can aim at that little fucker
            Debug.Assert(null != MyBulletManager);
            Vector2 shipPos = MyBulletManager.PlayerPosition(this);

            //TODO: this function doesn't seem to work... bullets sometimes just spin around in circles?

            //get the angle at that dude
            float val = (float)Math.Atan2((shipPos.X - X), -(shipPos.Y - Y));
            return val;
        }

Usage Example

示例#1
0
        public override ERunStatus Run(Bullet bullet)
        {
            ENodeType ENodeType = Node.NodeType;
            float value = (float)(Node.GetValue(this) * Math.PI / 180);

            switch (ENodeType)
            {
                case ENodeType.sequence:
                {
                    bullet.Direction = bullet.GetFireData().srcDir + value;
                }
                break;
                case ENodeType.absolute:
                {
                    bullet.Direction = value;
                }
                break;
                case ENodeType.relative:
                {
                    bullet.Direction = bullet.Direction + value;
                }
                break;
                default:
                {
                    bullet.Direction = bullet.GetAimDir() + value;
                }
                break;
            }

            TaskFinished = true;
            return ERunStatus.End;
        }
All Usage Examples Of Danmaku_no_Kyojin.BulletEngine.Bullet::GetAimDir