Exemplo n.º 1
0
        public bool GetAmmo(Ship ship, Map map, out LaserType a, out RocketType r, out HellstormType h)
        {
            a = ((this.DefaultLaser == LaserType.Default) ? LaserType.LCB_10 : this.DefaultLaser);
            r = this.DefaultRocket;
            h = this.DefaultHellstorm;
            if (!ship.IsNpc && !map.IsGG)
            {
                return(false);
            }
            SelectedNpcModel model = this.GetModel(ship, map, null, 0);

            if (model == null)
            {
                if (!map.IsGG)
                {
                    return(false);
                }
            }
            else
            {
                a = ((model.Laser == LaserType.Default) ? a : model.Laser);
                r = ((model.Rocket == RocketType.Default) ? r : model.Rocket);
                h = ((model.Hellstorm == HellstormType.Default) ? h : model.Hellstorm);
                bool flag;
                if (map.method_8(ship, out flag) && model.GgCornerLaser != LaserType.Default)
                {
                    a = model.GgCornerLaser;
                }
                else if (model.UseSab && ship.Shield >= 2000 && map.Hero.ShieldPercentage <= (float)this.MinSabShield && map.Hero.method_21("ammunition_laser_sab-50") > 100.0 && map.Hero.Formation != GEnum4.Moth)
                {
                    a = LaserType.SAB_50;
                }
            }
            return(true);
        }
Exemplo n.º 2
0
        public Rocket(int playerId, RocketType type, Vector2 target)
        {
            this.playerId         = playerId;
            this.type             = type;
            this.state            = RocketState.Idle;
            this.target           = target;
            this.velocity         = Vector2.Zero;
            this.acc              = Vector2.Zero;
            this.angle            = 0f;
            this.airFrictionCoeff = 0f;
            this.cruiseAltitude   = 0f;
            this.impact           = false;

            switch (type)
            {
            case RocketType.Thor4:
                this.airFrictionCoeff = 0.002f;
                this.cruiseAltitude   = -60f;
                break;

            case RocketType.Scout8:
                this.airFrictionCoeff = 0.002f;
                this.cruiseAltitude   = -40f;
                break;

            case RocketType.Northstar10:
                this.airFrictionCoeff = 0.002f;
                this.cruiseAltitude   = -80f;
                break;
            }
        }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        FrameCount += 1;
        if (Input.GetKeyDown(FireSimple))
        {
            //Debug.Log("Spawn rocket request...");
            Spawn(rocketType);
        }

        if (Input.GetKeyUp(ChangeRockeType))
        {
            if (rocketType == RocketType.Simple)
            {
                rocketType = RocketType.Guided;
            }
            else
            {
                rocketType = RocketType.Simple;
            }

            //Debug.Log("Now Spawning: " + rocketType.ToString());
        }

        fireCountDown -= Time.deltaTime;

        if (fireCountDown < 0)
        {
            Spawn(rocketType);
            fireCountDown = Random.Range(intervalRangeMin, intervalRangeMax);
        }
    }
        public async Task <IActionResult> Edit(int id, [Bind("rocketTypeID,width,height,rocketignitor,rocketPropellant")] RocketType rocketType)
        {
            if (id != rocketType.rocketTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rocketType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RocketTypeExists(rocketType.rocketTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rocketType));
        }
Exemplo n.º 5
0
        public override void OnUpdate(Scene scene)
        {
            if (Time.time > this.m_NextLaunch)
            {
                this.m_NextLaunch  = Time.time + this.m_Random.Next(5, 15) * 0.5f;
                this.m_FoundTarget = false;

                scene.world.ForEach(this.m_Query, FindTargetTile);

                double     rand = this.m_Random.NextDouble();
                RocketType type = RocketType.Thor4;

                if (rand < 0.5f)
                {
                    type = RocketType.Thor4;
                }
                else if (rand < 0.85f)
                {
                    type = RocketType.Scout8;
                }
                else
                {
                    type = RocketType.Northstar10;
                }

                var entity = scene.world.CreateEntity(this.m_Arch);
                var spawn  = RocketMission.launchLocations[PlayerAI.playerId] + new Vector2(10f, -10f);

                scene.world.SetComponentData <Position>(entity, new Position(spawn));
                scene.world.SetComponentData <Rocket>(entity, new Rocket(PlayerAI.playerId, type, this.m_TargetPosition));
            }
        }
        public RocketType[] GetAvailableRocketTypes()
        {
            var result = new RocketType[rockets.Count];

            rockets.Keys.CopyTo(result, 0);
            return(result);
        }
Exemplo n.º 7
0
    private void GeneratePlanets(bool isLoadRequest = false, GameState gameState = null)
    {
        for (int i = 0; i < totalPlanets; i++)
        {
            GameObject planet = Instantiate(gameConfig.planetPrefab);
            planet.name = "Planet " + i;
            PlanetState planetState;
            if (isLoadRequest)
            {
                planetState = gameState.planetsStates[i];
            }
            else
            {
                RocketType rocketType = ComputationalFunctions.getRandomRocketType();
                int        matIndex   = randomMaterialsOrder[i];
                Color      col        = i > 0 ? gameConfig.enemyColor : gameConfig.playerColor;
                Vector3    pos        = ComputationalFunctions.getRandomPositionOnOrbit(randomOrbitsOrder[i], totalPlanets, gameConfig.distanceBetweenOrbits);
                float      HP         = gameConfig.planetMaxHP;
                float      RT         = GetRocketReloadCooldown(rocketType);

                planetState = new PlanetState(rocketType, matIndex, col, pos, HP, RT);
            }

            planet.GetComponent <PlanetManager>().Initialize(planetState);
            planets.Add(planet);
        }
    }
    public void BuildRocket(RocketType rocketType)
    {
        Planet currPlanet = PlayerStatController.instance.currentPlanet;

        //Check if the planet has enough space for a new rocket
        if (!currPlanet.isRocketCapacityFull())
        {
            //Queue
            //Begin construction of a rocket
            RocketPanelForQueue panel = Instantiate(rocketPanelForQueue, queuePanel.transform).GetComponent <RocketPanelForQueue>();

            //Add rocket to queue
            RocketQueueItem newRocket = new RocketQueueItem();
            newRocket.constructionTime = 10;
            newRocket.rocketType       = rocketType;
            currPlanet.rocketConstructionQueue.Add(newRocket);
            currPlanet.constructingRockets++;
            panel.rocketQueueItem = newRocket;
            panel.SetText();
        }
        //Rocket Capacity Full
        else
        {
            Debug.Log("Rocket Capacity Full!");
        }
    }
Exemplo n.º 9
0
 public RocketController this[RocketType type]
 {
     get
     {
         Init();
         return(dictionary[type]);
     }
 }
Exemplo n.º 10
0
 public PlanetState(RocketType rocketType, int matIndex, Color contrCol, Vector3 pos, float curHP, float curRT)
 {
     this.rocketType = rocketType;
     this.matIndex   = matIndex;
     this.contrCol   = contrCol;
     this.pos        = pos;
     this.curHP      = curHP;
     this.curRT      = curRT;
 }
Exemplo n.º 11
0
 protected virtual void LaunchRocket(RocketType rocketType)
 {
     if (CheckLaunchPossible())
     {
         float coolDown = rocketLaunchSystem.InitiateLaunch(this, rocketType, GetRocketSendDirection()).GetRocketCooldown();
         stats.Cooldown = coolDown;
         CooldownChanged?.Invoke(coolDown);
     }
 }
Exemplo n.º 12
0
    public void Spawn(RocketType type)
    {
        var rocket = RocketFactory.CreateRocket(type);

        rocket.transform.position = gameObject.transform.position;
        rocket.GetComponent <Rocket>().Initialize(type, Target);
        audioSource.PlayOneShot(SoundFX.MissileLaunch);
        //Debug.Log("Rocket Spaned!!!!");
    }
Exemplo n.º 13
0
    public void HitByOther()
    {
        Target     = null;
        rocketType = RocketType.HitByOther;

        rb.velocity = rb.velocity * -2;

        explodeInSec = 3f;
        destroyInSec = 5 + explodeInSec;
    }
Exemplo n.º 14
0
 public void Initialize(PlanetState planetState)
 {
     this.transform.position    = planetState.pos;
     this.planetMatIndex        = planetState.matIndex;
     this.rocketType            = planetState.rocketType;
     this.controllerColor       = planetState.contrCol;
     this.currentHP             = planetState.curHP;
     this.currentReloadCooldown = planetState.curRT;
     updatePlanetValues();
 }
Exemplo n.º 15
0
    public void CreateRocket(RocketType rocketType, Transform planet, Vector3 direction)
    {
        var newRocket = Instantiate(rocketCollection[rocketType]);

        newRocket.transform.position = planet.position;
        newRocket.gameObject.transform.SetParent(rocketParent.transform);
        newRocket.Initialize(direction, planet.gameObject);

        existedRockets.Add(newRocket);
    }
Exemplo n.º 16
0
        public void Init(float maxHealth, RocketType rocketType)
        {
            RocketData            rocketData            = new RocketData();
            RocketCharacteristics rocketCharacteristics = rocketData.GetCharacteristics(rocketType);

            countdown = rocketCharacteristics.Cooldown;
            rocketImageButton.sprite = rocketCharacteristics.sprite;
            rocketButton.onClick.AddListener(ClickRocketButton);
            healthBarSlider.maxValue = maxHealth;
            healthBarSlider.value    = maxHealth;
        }
        public async Task <IActionResult> Create([Bind("rocketTypeID,width,height,rocketignitor,rocketPropellant")] RocketType rocketType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rocketType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(rocketType));
        }
Exemplo n.º 18
0
 public void Init(RocketType rocketType, float currentHealth, bool isMain = false)
 {
     if (isMain)
     {
         MainParticle.SetActive(true);
     }
     this.currentHealth    = currentHealth;
     this.rocketType       = rocketType;
     rocketCharacteristics = rocketData.GetCharacteristics(rocketType);
     ellipseHelper         = new Ellipse();
 }
Exemplo n.º 19
0
        public RocketProvider GetRocketPrefab(RocketType rocketType)
        {
            for (int i = 0; i < _rocketsPrefabs.Length; i++)
            {
                if (_rocketsPrefabs[i].RocketType == rocketType)
                {
                    return(_rocketsPrefabs[i]);
                }
            }

            return(null);
        }
        public Rocket InitiateLaunch(Player initiator, RocketType rocketName, Vector3 direction)
        {
            RocketParameters parameters = GM.RocketTypes.GetRocketParameters(rocketName);
            Rocket           newRocket  = GameObject.Instantiate(parameters.prefab,
                                                                 initiator.transform.position + direction * initiator.transform.localScale.x,
                                                                 Quaternion.LookRotation(direction, Vector3.back)).AddComponent <Rocket>();

            newRocket.OverwriteProperties(parameters);
            newRocket.LauncherPlanet = initiator.gameObject;

            return(newRocket);
        }
Exemplo n.º 21
0
 public Cannon(
     Transform transform,
     float reloadingTime,
     RocketType rocketType,
     RocketsFactory rocketsFactory
     )
 {
     _transform      = transform;
     _reloadingTime  = reloadingTime;
     RocketType      = rocketType;
     _rocketsFactory = rocketsFactory;
 }
 private void CheckUserInput(string userRocketType)
 {
     if (RocketValidation.IsRocketTypeValid(userRocketType))
     {
         RocketType rocketType = (RocketType)Enum.Parse(typeof(RocketType), userRocketType);
         _rocketFactory.AddRocket(rocketType);
     }
     else
     {
         _consoleSystem.Write($"There is no rocket with the type: {userRocketType}");
     }
 }
Exemplo n.º 23
0
    public void Initialize(RocketType type, GameObject target)
    {
        initialRocketType = type;
        rocketType        = type;
        Target            = target;

        rb.velocity        = (Target.transform.position - transform.position).normalized * speed;
        transform.rotation = Quaternion.LookRotation(rb.velocity) * Quaternion.Euler(rocketRotation);

        audioSource.clip = SoundFX.MissileTravel;
        audioSource.loop = true;
        audioSource.Play();
    }
Exemplo n.º 24
0
    public static GameObject CreateRocket(RocketType type)
    {
        var rocket = Instance.factory[type].GetObject();

        if (rocket == null)
        {
            rocket = Instantiate(Instance.RocketPrefabs[0], Instance.graveyardPosition, Quaternion.identity);
            Instance.factory[type].Add(rocket);
        }

        rocket.SetActive(true);
        return(rocket);
    }
Exemplo n.º 25
0
        private void CheckUserInput(string userRocketType, string userRocketAmount)
        {
            if (RocketValidation.IsRocketTypeValid(userRocketType))
            {
                RocketType rocketType = (RocketType)Enum.Parse(typeof(RocketType), userRocketType);
                int        amount     = int.Parse(userRocketAmount);

                int amontRoketlaunch = _battery.LaunchFewRockets(rocketType, amount);
                _consoleSystem.Write($"the rocket amount success to launch: {amontRoketlaunch.ToString()}");
            }
            else
            {
                _consoleSystem.Write($"There is no rocket with the type: {userRocketType}");
            }
        }
Exemplo n.º 26
0
        public int LaunchFewRockets(RocketType rocketType, int amount)
        {
            List <IRocket> rockets       = new List <IRocket>();
            List <IRocket> rocketsByType = _allRockets.Where(r => r.RocketType == rocketType).ToList();

            if (rocketsByType.Count() >= amount)
            {
                rockets = LaunchRocket(rocketsByType.Take(amount).ToList());
                RemoveFromList(rockets);

                return(rockets.Count());
            }

            return(0);
        }
Exemplo n.º 27
0
        public static bool HasEnoughForRocket(RocketType type)
        {
            switch (type)
            {
            case RocketType.Thor4:
                return(derylium >= 20 && ziklium >= 10);

            case RocketType.Scout8:
                return(derylium >= 30 && ziklium >= 25);

            case RocketType.Northstar10:
                return(derylium >= 45 && ziklium >= 30);
            }

            return(false);
        }
Exemplo n.º 28
0
    private void SetRocketPool(RocketType type)
    {
        switch (type)
        {
        case RocketType.Blue:
            currentPool = rocketBluePool;
            break;

        case RocketType.Green:
            currentPool = rocketGreenPool;
            break;

        case RocketType.Yellow:
            currentPool = rocketYellowPool;
            break;
        }
    }
Exemplo n.º 29
0
        public RocketCharacteristics GetCharacteristics(RocketType rocketType)
        {
            switch (rocketType)
            {
            case RocketType.Small:
                return(new RocketCharacteristics
                {
                    Acceleration = 2.2f,
                    Weight = 0.4f,
                    Cooldown = 3,
                    Damage = 25,
                    sprite = Resources.Load <Sprite>(GameData.ROCKET0_SPRITE_PATH)
                });

            case RocketType.Middle:
                return(new RocketCharacteristics
                {
                    Acceleration = 2f,
                    Weight = 0.5f,
                    Cooldown = 2,
                    Damage = 40,
                    sprite = Resources.Load <Sprite>(GameData.ROCKET1_SPRITE_PATH)
                });

            case RocketType.Big:
                return(new RocketCharacteristics
                {
                    Acceleration = 1.5f,
                    Weight = 0.6f,
                    Cooldown = 1,
                    Damage = 50,
                    sprite = Resources.Load <Sprite>(GameData.ROCKET2_SPRITE_PATH)
                });

            default:
                return(new RocketCharacteristics
                {
                    Acceleration = 3,
                    Weight = 1,
                    Cooldown = 3,
                    Damage = 20,
                    sprite = Resources.Load <Sprite>(GameData.ROCKET0_SPRITE_PATH)
                });
            }
        }
Exemplo n.º 30
0
    public void SetRocketAmmo(RocketType type, int ammo)
    {
        switch (type)
        {
        case RocketType.Normal:
            normalRocket.SetAmmo(ammo);
            break;

        case RocketType.Fast:
            fastRocket.SetAmmo(ammo);
            break;

        case RocketType.Deadly:
            deadlyRocket.SetAmmo(ammo);
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(type), type, null);
        }
    }