Example #1
0
 //private Effect effect;
 public FireEffectDrawer(IObjectEffect objectEffect, GameObject gameObject)
     : base(objectEffect, gameObject)
 {
     this.gameObject = gameObject;
     this.objectEffect = objectEffect;
     //this.effect = effect;
 }
Example #2
0
 public MaterialReader(GameObject gameObject, string name)
 {
     this.gameObject = gameObject;
     xml=XDocument.Load("Data\\materials\\"+name+".xml");
        // Vector3 test = getVector("BlueGlass", "specular");
     //Vector4 ble;
 }
Example #3
0
        //TODO: ENUM!!!!!!!! (albo XML)
        /// <summary>
        /// Deprecated
        /// </summary>
        /// <param name="gameObject"></param>
        /// <param name="name"></param>
        private void AddEffectToAnObject(GameObject gameObject, string name)
        {
            IObjectEffect gameEffect;
            if (name == "water")
                gameEffect = new WaterEffect(gameObject,MainGame);
            else if(name=="fire")
            {
                gameEffect = new FireEffect(gameObject, MainGame);
                AddEffectToAnObject(gameObject,"smoke");
                gameEffect.IsActive = true;

            }
            else
            {
                 gameEffect = new FireSmokeEffect(gameObject, MainGame);
                 gameEffect.IsActive = true;
            }

            gameObject.EffectList.Add(gameEffect);
        }
Example #4
0
 public void PointTurretToGameObject(GameObject gameObject)
 {
     var longitudinalDifference = gameObject.Position.X - Position.X;
     var latitudinalDifference = gameObject.Position.Z - Position.Z;
     double result = 0;
     var azimuth = (Math.PI * .5d) - Math.Atan(latitudinalDifference / longitudinalDifference);
     if (longitudinalDifference > 0) result = azimuth;
     else if (longitudinalDifference < 0) result = azimuth + Math.PI;
     else if (latitudinalDifference < 0)
         result = Math.PI;
     else
         result = 0d;
     turretDestination = (float)(result - Angle.Y);
 }
Example #5
0
        private int[,] PutUnits(ref int[,] map, List<GameObject> gameObjects, GameObject current)
        {
            int[,] output = new int[map.GetLength(0), map.GetLength(1)];

            for (int i = 0; i < map.GetLength(0); i++)
            {
                for (int j = 0; j < map.GetLength(1); j++)
                {
                    output[i, j] = map[i, j];
                }
            }

            foreach (GameObject gameObject in gameObjects)
            {
                if ((gameObject is Unit || gameObject is Civilian) && gameObject != current)
                {
                    IPhysical physical = gameObject as IPhysical;
                    int startI = Convert.ToInt32(Math.Floor(gameObject.Position.X - physical.Width/2.0)) - lastRadius;
                    if(startI < 0) startI = 0;
                    int endI = Convert.ToInt32(Math.Ceiling(gameObject.Position.X + physical.Width/2.0)) + lastRadius;
                    if(endI >= map.GetLength(0)) endI = map.GetLength(0) - 1;
                    int startJ = Convert.ToInt32(Math.Floor(gameObject.Position.Z - physical.Length/2.0)) - lastRadius;
                    if (startJ < 0) startJ = 0;
                    int endJ = Convert.ToInt32(Math.Ceiling(gameObject.Position.Z + physical.Length/2.0)) + lastRadius;
                    if (endJ >= map.GetLength(0)) endI = map.GetLength(0) - 1;
                    for (int i = startI; i < endI; ++i)
                    {
                        for (int j = startJ; j < endJ; ++j)
                        {
                            if (i < 0 || j < 0)
                                throw new ArgumentOutOfRangeException("Bad location of object" + physical.ToString());
                            output[i, j] = M;
                        }
                    }
                }
            }

            return output;
        }
Example #6
0
 public VehicleDrawer(GameObject gameObject)
     : base(gameObject)
 {
 }
Example #7
0
 public EffectDrawer(IObjectEffect _objectEffect, GameObject _gameObject)
 {
     objectEffect = _objectEffect;
     gameObject = _gameObject;
 }
Example #8
0
 public FireSmokeEffect(GameObject gameObject, Game game)
 {
     GameObject = gameObject;
     CreateParticleEmitter(game);
 }
Example #9
0
 public BuildingDrawer(GameObject gameObject)
     : base(gameObject)
 {
 }
Example #10
0
 public MiniModelDrawer(GameObject gameObject)
 {
     GameObject = gameObject;
 }
Example #11
0
        /// <summary>
        /// Dodaje obiekt i jego potomków do listy.
        /// </summary>
        /// <param name="gameObject">Obiekt do dodania</param>
        /// <param name="mission">Misja, do której obiekt jest wysyłany</param>
        public void AddGameObject(GameObject gameObject, Mission mission)
        {
            gameObject.Mission = mission;
            foreach (GameObject child in gameObject.GetChildren())
            {
                child.Mission = mission;
            }

            gameObjects.Add(gameObject);
            gameObjects.AddRange(gameObject.GetChildren());
        }
Example #12
0
 public StaticDrawer(GameObject gameObject)
     : base(gameObject)
 {
 }
Example #13
0
 public WaterEffectDrawer(IObjectEffect objectEffect, GameObject gameObject)
     : base(objectEffect,gameObject)
 {
     this.gameObject = gameObject;
     this.objectEffect = objectEffect;
 }
Example #14
0
        public WaterEffect(GameObject gameObject, Game game)
        {
            GameObject = gameObject;

            CreateParticleEmitter(game);
        }
Example #15
0
 public GameObjectDrawer(GameObject gameObject)
 {
     GameObject = gameObject;
 }
Example #16
0
 public PeopleDrawer(GameObject gameObject)
     : base(gameObject)
 {
 }