public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
            {
                var chunkTranslations      = chunk.GetNativeArray(TranslationType);
                var chunkRotations         = chunk.GetNativeArray(RotationType);
                var chunkPhysicsVelocities = chunk.GetNativeArray(PhysicsVelocityType);
                var chunkPhysicsMasses     = chunk.GetNativeArray(PhysicsMassType);
                var chunkMissiles          = chunk.GetNativeArray(MissileType);
                var chunkAlivePeriods      = chunk.GetNativeArray(AlivePeriodType);

                for (var i = 0; i < chunk.Count; ++i)
                {
                    var     translation = chunkTranslations[i].Value;
                    var     rotation    = chunkRotations[i].Value;
                    ref var pv          = ref chunkPhysicsVelocities.AsWritableRef(i);
                    var     pm          = chunkPhysicsMasses[i];
                    var     missile     = chunkMissiles[i];
                    var     ap          = chunkAlivePeriods[i];

                    var elapsed = Time - ap.StartTime;
                    if (elapsed < 1f)
                    {
                        pv.Linear = missile.Velocity;
                    }
                    else
                    {
                        var diff           = missile.Target - translation;
                        var relativeTorque = rotation.CalcSpringTorqueRelative(diff, 24f, Dt);
                        pv.ApplyAngularImpulse(pm, relativeTorque);
                        pv.ApplyLinearImpulse(pm, math.mul(rotation, new float3(0, 0, 400f * Dt)));
                    }
                    if (ap.GetRemainTime(Time) < 0f)
                    {
                        ExplosionSystem.Instantiate(CommandBuffer, chunkIndex /* jobIndex */, translation, ExplosionPrefab, Time);
                    }
                }
        protected Dictionary <int, AbstractEntity> menuItemList = new Dictionary <int, AbstractEntity>(); // For when selecting item to pick up etc...

        public AbstractRoguelike(int maxLogEntries)
        {
            this.ecs     = new BasicEcs(this);
            this.mapData = new MapData();
            this.gameLog = new GameLog(maxLogEntries);

            new CloseCombatSystem(this.ecs);
            new MovementSystem(this.ecs, this.mapData);

            this.CreateData();

            this.view          = new DefaultRLView(this);
            this.drawingSystem = new DrawingSystem(this.view, this);

            this.checkVisibilitySystem = new CheckMapVisibilitySystem(this.ecs, this.mapData);
            new ShootOnSightSystem(this.ecs, this.checkVisibilitySystem, this.ecs.entities);

            this.checkVisibilitySystem.process(this.playersUnits);
            this.damageSystem    = new DamageSystem(this.ecs, this.gameLog);
            this.explosionSystem = new ExplosionSystem(this.ecs, this.checkVisibilitySystem, this.damageSystem, this.mapData, this.ecs.entities);
            new TimerCountdownSystem(this.ecs, this.explosionSystem);
            this.pickupItemSystem = new PickupDropSystem();
            this.effectsSystem    = new EffectsSystem(this.ecs);
            new ThrowingSystem(this.ecs, this.mapData, this.gameLog);
            new ShootingSystem(this.ecs, this.gameLog);

            // Draw screen
            this.drawingSystem.Process(this.effectsSystem.effects);
        }
Пример #3
0
 public GameView(Texture2D spark, Texture2D smoke, Texture2D explosion, Rectangle gameWindow, Vector2 startPosition)
 {
     this.spark         = spark;
     this.smoke         = smoke;
     this.explosion     = explosion;
     this.gameWindow    = gameWindow;
     this.startPosition = startPosition;
     sparkSystem        = new SparkSystem(startPosition);
     smokeSystem        = new SmokeSystem(startPosition);
     explosionSystem    = new ExplosionSystem(startPosition);
 }
Пример #4
0
 public void StartGame()
 {
     stats.StartGame();
     UImanager.StartGame();
     Color[] cS = CurrentGameMode.Colors.ToArray();
     particleManager.StartGame(cS);
     gridSystem.StartGame(CurrentGameMode.GridXLength, CurrentGameMode.GridYLength, CurrentGameMode.BombPieceInstantiateEveryXPoint.Value, cS);
     selectorManager.StartGame(gridSystem.oneSideScale, CurrentGameMode.GridElements);
     ExplosionSystem.StartGame(CurrentGameMode.ExplosionTypes, CurrentGameMode.GridYLength);
     GameSkeleton.inputManager.IsReadyForInput = true;
 }
Пример #5
0
    /// <summary>
    /// The turn the routine of this selector.
    /// </summary>
    /// <returns>The routine.</returns>
    /// <param name="angleDir">Angle dir.</param>
    public override IEnumerator TurnRoutine(int angleDir)
    {
        GameSkeleton.inputManager.IsReadyForInput = false;
        SelectorManager selectorManager = GameSkeleton.selectorManager;

        //initialize selecteds
        List <Transform> selecteds = selectorManager.SelectedPieceGroup.AddThisGroupPiecesInToTheTransformList();

        initializeSelectedsForTurn(selecteds);

        //get start rotation euler
        Vector3 startEuler = selectorManager.currentSelectorObject.transform.rotation.eulerAngles;

        //this is the algorith for that when in 3 selecteds turned on clockwise, if 2 of them in left 1 of them is right, indexes changes clockwise
        //but the in other situation indexes changes counter-clockwise
        //index turn direction also can be found with middle index minus lower index == 1 or bigger,
        int indexTurnDir = selecteds.CheckIfItsHaveAHighestXValue() == true ? angleDir : -angleDir;

        for (int i = 0; i < 3; i++)
        {
            //turn the selector
            for (int x = 0; x < 10; x++)
            {
                startEuler.z += (12f * angleDir);
                selectorManager.currentSelectorObject.transform.rotation = Quaternion.Euler(startEuler);
                yield return(new WaitForFixedUpdate());
            }
            //correct Selecteds rotation
            for (int b = 0; b < selecteds.Count; b++)
            {
                selecteds [b].GetComponent <GridPiece> ().CorrectRotationWhenSelectorTurns();
            }
            //turn idexes according to indexTurnDirection
            TurnSelectedIndexesInGridSystem(indexTurnDir);
            //wait for smoothness
            yield return(new WaitForSeconds(0.05f));

            //check for any explosion
            if (ExplosionSystem.IsAnyExplosionInTheSystem)
            {
                resetSelectedsAfterTurn(selecteds);
                selectorManager.currentSelectorObject.SetActive(false);
                Stats.movedCountSystem.ActionMaded();
                yield return(GameSkeleton.Instance.StartCoroutine(ExplosionSystem.Explode()));

                yield break;
            }
        }
        resetSelectedsAfterTurn(selecteds);

        GameSkeleton.inputManager.IsReadyForInput = true;
    }
Пример #6
0
 public GameController(Texture2D spark, Texture2D smoke, Texture2D explosion, Rectangle gameWindow,
                       Vector2 startPosition, SpriteBatch spriteBatch, Camera camera, SoundEffect explosionSound)
 {
     this.spark          = spark;
     this.smoke          = smoke;
     this.explosion      = explosion;
     this.gameWindow     = gameWindow;
     this.startPosition  = startPosition;
     this.spriteBatch    = spriteBatch;
     this.camera         = camera;
     this.explosionSound = explosionSound;
     sparkSystem         = new SparkSystem(startPosition);
     smokeSystem         = new SmokeSystem(startPosition);
     explosionSystem     = new ExplosionSystem(startPosition, explosionSound);
 }
Пример #7
0
    void LataaEfektit()
    {
#if EFFECTS
        tykkiSuuliekki                 = new ExplosionSystem(liekinKuva, 50);
        tykkiSuuliekki.MinScale        = 11;
        tykkiSuuliekki.MaxScale        = 55;
        tykkiSuuliekki.MaxVelocity     = 3;
        tykkiSuuliekki.MinVelocity     = 1;
        tykkiSuuliekki.MaxAcceleration = 5;
        Add(tykkiSuuliekki);

        kopteriRajahdys = new ExplosionSystem(liekinKuva, 50);
        Add(kopteriRajahdys);

        tykinOsuma          = new ExplosionSystem(liekinKuva, 50);
        tykinOsuma.MinScale = 22;
        tykinOsuma.MaxScale = 110;
        Add(tykinOsuma);

        tirskahdus          = new ExplosionSystem(pisteKuva, 50);
        tirskahdus.MinScale = 5;
        tirskahdus.MaxScale = 10;
        //tirskahdus.MaxVelocity = 3;
        //tirskahdus.MinVelocity = 1;
        tirskahdus.MaxAcceleration = 0.5;
        tirskahdus.MaxLifetime     = 0.2;
        Add(tirskahdus);

        tankkiRajahdys          = new ExplosionSystem(tankkiPartikkeli, 150);
        tankkiRajahdys.MinScale = 60;
        tankkiRajahdys.MaxScale = 300;
        //tankkiRajahdys.MinAcceleration = 0.1;
        //tankkiRajahdys.MaxAcceleration = 0.2;
        //tankkiRajahdys.MinLifetime = 20.0;
        tankkiRajahdys.MaxLifetime = 30.0;
        //tankkiRajahdys.MaxVelocity = 0.1;
        Add(tankkiRajahdys);

        tankkiinOsui                 = new ExplosionSystem(osumaPartikkeli, 30);
        tankkiinOsui.MinScale        = 12;
        tankkiinOsui.MaxScale        = 30;
        tankkiinOsui.MaxAcceleration = 0.5;
        tankkiinOsui.MinLifetime     = 0.2;
        tankkiinOsui.MaxLifetime     = 0.5;
        Add(tankkiinOsui);
#endif
    }
Пример #8
0
    public static IEnumerator Explode()
    {
        //patlayacak tüm grupları al
        List <IndexGroup> explodingGroups = giveEveryGroupThatGoingToExplodeInExplosionTypes();

        //patlayacak gruplarda
        visualProcessInTheExplodingGroups(explodingGroups);
        yield return(GameSkeleton.Instance.StartCoroutine(spawnNewPiecesInTheMapAndRecorrectGridIndexes(divideExplodingGroupsInToColumns(explodingGroups))));

        yield return(new WaitForSeconds(.1f));

        if (IsAnyExplosionInTheSystem)
        {
            GameSkeleton.Instance.StartCoroutine(ExplosionSystem.Explode());
            yield break;
        }
        //Game over checks
        GameSkeleton.Instance.GameOverChecks();
    }
Пример #9
0
    private void StarXplosion(int currentStar, int ofStars, GameObject onTopOfTarget)
    {
        if (currentStar > 0 && currentStar <= 3)
        {
            ExplosionSystem starplosion = new ExplosionSystem(LoadImage("juststar"), 50);
            starplosion.MinVelocity = starplosion.MinVelocity / 2;
            starplosion.MaxVelocity = starplosion.MaxVelocity / 2;
            Add(starplosion, 3);
            var explosionPosition = new Vector(
                onTopOfTarget.AbsolutePosition.X - onTopOfTarget.Width / 2 + currentStar * onTopOfTarget.Width / 4,
                onTopOfTarget.AbsolutePosition.Y - onTopOfTarget.Height / 3);
            onTopOfTarget.Image = LoadImage(String.Format("level_{0}star", currentStar));
            starplosion.AddEffect(explosionPosition, 5 + 5 * currentStar);

            if (currentStar < ofStars)
            {
                Timer.SingleShot(starplosion.MaxLifetime,
                                 () => StarXplosion(currentStar + 1, ofStars, onTopOfTarget));
            }
        }
    }
Пример #10
0
    void LuoKentta()
    {
        MediaPlayer.Play("mario");
        TileMap kentta = TileMap.FromLevelAsset("kentta1");

        kentta.SetTileMethod('0', LisaaTaso2);
        kentta.SetTileMethod('2', LisaaTaso5);
        kentta.SetTileMethod('#', LisaaTaso);
        kentta.SetTileMethod('*', LisaaTahti);
        kentta.SetTileMethod('N', LisaaPelaaja);
        kentta.SetTileMethod('1', LisaaPelaaja2);
        kentta.SetTileMethod('A', LisaaTahti2);
        kentta.SetTileMethod('5', LisaaTahti3);
        kentta.Execute(RUUDUN_KOKO, RUUDUN_KOKO);
        Level.CreateBorders();
        Level.Background.Image = null;
        //  Level.Background.TileToLevel();
        LuoPisteLaskuri(0, Screen.Bottom + 20);

        rajahdys = new ExplosionSystem(rajahdyskuva, 200);
        Add(rajahdys);
    }
Пример #11
0
 public void Initiate()
 {
     sparkSystem     = new SparkSystem(startPosition);
     smokeSystem     = new SmokeSystem(startPosition);
     explosionSystem = new ExplosionSystem(startPosition);
 }
Пример #12
0
 /// <summary>
 /// Lisää efektin sen olion kohdalle, johon törmätään.
 /// </summary>
 /// <param name="expSystem">Efektijärjestelmä</param>
 /// <param name="numParticles">Kuinka monta partikkelia laitetaan</param>
 /// <returns></returns>
 public static CollisionHandler <PhysicsObject, PhysicsObject> AddEffectOnTarget(ExplosionSystem expSystem, int numParticles)
 {
     return(delegate(PhysicsObject collidingObject, PhysicsObject targetObject)
     {
         expSystem.AddEffect(targetObject.Position, numParticles);
     });
 }
 // Use this for initialization
 void Awake()
 {
     Instance = this;
 }
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     camera.setSizeOfField(graphics.GraphicsDevice.Viewport);
     spriteBatch = new SpriteBatch(GraphicsDevice);
     ballSimulation = new BallSimulation();
     gameView = new GameView(graphics, ballSimulation, Content, camera);
     explosionSystem = new ExplosionSystem(camera, Content);
     // TODO: use this.Content to load your game content here
 }