Пример #1
0
        ///<summary>
        ///initialize using associated entity
        ///</summary>
        ///<param name="entity">associated entity</param>
        public void Initialize(Entity entity)
        {
            _projectilePellet = entity as ProjectilePellet;

            //Material =
            //   TorqueObjectDatabase.Instance.FindObject("bulletMaterial")
            //   as SimpleMaterial;

            SimpleMaterial simpleMaterial = new SimpleMaterial();
            simpleMaterial.TextureFilename = @"data\images\GarageGames\bullet";
            simpleMaterial.IsTranslucent = true;
            simpleMaterial.IsColorBlended = true;

            Material = simpleMaterial;

            Layer = 0;
            IsTemplate = false;
            Size = new Vector2(4, 4);
        }
Пример #2
0
        ///<summary>
        ///add a shotgun pellet to the game
        ///</summary>
        ///<param name="shooter"></param>
        ///<param name="target"></param>
        public void AddShotgunPellet(BotEntity shooter, Vector2 target)
        {
            Projectile projectile =
                new ProjectilePellet(shooter, target, new PelletSceneObject());

            Projectiles.Add(projectile);

            projectile.Name = "TempPelletName";
            //register the pellet with the entity manager
            EntityManager.Instance.RegisterEntity(projectile);
            projectile.Name = "PELLET_" + projectile.ObjectId;

            LogUtil.WriteLineIfLogCreate("Adding a shotgun shell " +
                                         projectile.ObjectId + " at position " + projectile.Position);
        }