Esempio n. 1
0
        public void AddObject(string name, GOParams par)
        {
            UGameObjectBase u = null;

            switch (name)
            {
            case "SimpleFlyer":
                u = new UGameObjectBase(par.X, par.Y, "flyerRed1", 1);
                u.SetContainerSize(40, 40);
                u.Par.Velocity = 3;
                u.SetAngle(-90);
                u.Par.AngularVelocity = 1;
                u.AddBehavior(new ControlSimpleFlyer(), "ctrl");
                u.Par.ChargeLevel = 1000;
                u.Par.ChargeReady = 1000;
                u.Par.ChargeRate  = 10;
                u.AddBehavior(new ShootWhenAimed(Base, "Rocket", friendly), "Shoot");
                u.AddBehavior(new Reloading(), "Reloadng");
                enemies.Add(u);

                break;
            }

            if (u != null)
            {
                GameObjectsList.Add(u);
                teamUnits[u.Team].Add(u);
            }
        }
Esempio n. 2
0
        public void AddShell(string name, List <UGameObjectBase> targetList, int X, int Y, int Angle, int Range)
        {
            UGameObjectBase obj = null;

            switch (name)
            {
            case "LightShell":
                obj = new UGameObjectBase(X, Y, "blast5");
                Map.ContainerSetMaxSide(obj.Container, 12);
                obj.Par.Velocity = 12;
                obj.AddBehavior(new MoveForward(), "MoveForward");
                obj.SetAngle(Angle);
                obj.AddBehavior(new hitAny(targetList), "hitAny");
                obj.Par.DamageMax = 5;

                break;

            case "ArmorPiercing":
                obj = new UGameObjectBase(X, Y, "blast5");
                Map.ContainerSetMaxSide(obj.Container, 17);
                obj.Par.Velocity = 12;
                obj.AddBehavior(new MoveForward(), "MoveForward");
                obj.SetAngle(Angle);
                obj.AddBehavior(new hitAny(targetList), "hitAny");
                obj.Par.DamageMax = 50;
                break;

            case "Ripper":
                obj = new UGameObjectBase(X, Y, "blast5");
                Map.ContainerSetMaxSide(obj.Container, 25);
                obj.Par.Velocity = 12;
                obj.AddBehavior(new MoveForward(), "MoveForward");
                obj.SetAngle(Angle);
                obj.AddBehavior(new hitAny(targetList), "hitAny");
                obj.Par.DamageMax = 200;
                break;

            case "Rocket":
                obj = new UGameObjectBase(X, Y, "MissileRed1", 1);
                obj.SetContainerSize(30, 12);
                obj.Par.Velocity = 8;
                obj.SetAngle(Angle);
                obj.AddBehavior(new MoveForward(), "Move");
                obj.AddBehavior(new Hit(Base), "Hit");

                break;
            }

            if (obj != null)
            {
                GameObjectsList.Add(obj);
                obj.Par.Par.Add("Distance", 0);
                obj.Par.Range = Range;
                obj.Par.Type  = UnitTypes.shell;
            }
        }