示例#1
0
    public void Fire()
    {
        GameObject go         = (GameObject)Instantiate(bulletPrefab, transform.position, Quaternion.Euler(0, 180, 0));
        BulletLife bulletLife = go.GetComponent <BulletLife>();

        bulletLife.damage = bulletDamage;
        bulletLife.SetTarget(new Vector3(0, GetComponent <EnemyMovement>().Height, 0));
    }
示例#2
0
        public void checkIfHitObject(MapLayer tilemap, int xDirection, int yDirection)
        {
            int result = tilemap.isPassable((xDirection) / 32, (yDirection + (sprite.Height)) / 32);

            if (result == 0)
            {
                bulletLife = BulletLife.Dead;
            }
        }
示例#3
0
 public Bullet(Texture2D sprite, Vector2 position, string spriteFacing, Vector2 motion)
 {
     this.sprite       = sprite;
     this.position     = position;
     speed             = 7.0f;
     rotation          = 0.0f;
     this.motion       = motion;
     this.spriteFacing = (Constants.Direction)Enum.Parse(typeof(Constants.Direction), spriteFacing, true);
     bulletLife        = BulletLife.Alive;
     boundingBox       = new Rectangle((int)position.X, (int)position.Y, sprite.Width, sprite.Height);
 }