Inheritance: MonoBehaviour
Ejemplo n.º 1
0
    protected override void Attack()
    {
        // spawn a shockwave on the panel to the left of this mettaur

        PanelController toTheLeft = battlefield.GetPanelRelativeTo(enemy.panelCurrentlyOn, Direction.left);

        Vector3 spawnPos = toTheLeft.transform.position;

        spawnPos.y = enemy.transform.position.y;

        // TODO: play an animation, make the shockwave spawn at the end of it

        // spawn the shockwave prefab and move it
        string     prefabPath      = "Prefabs/Attacks/Shockwave";
        GameObject shockwavePrefab = Resources.Load <GameObject>(prefabPath);

        GameObject shockWaveGo = MonoBehaviour.Instantiate <GameObject>(shockwavePrefab);

        shockWaveGo.transform.position = spawnPos;

        Shockwave shockwaveScript = shockWaveGo.GetComponent <Shockwave>();

        shockwaveScript.Init(enemy);
        shockwaveScript.moveSpeed = shockwaveSpeed;
        shockwaveScript.Move(Vector3.left);

        Debug.Log(enemy.name + " created a shockwave!");
        ResetAttackDelay();
        PassToNextMett();
    }
Ejemplo n.º 2
0
        public void Shoot()
        {
            if (this.IsDead.IsNotTrue())
            {
                Action shoot = () =>
                {
                    var bullet = new Projectile(this.Location, this.Angle.ToType <float>());
                    bullet.Init();
                    bullet.ID += "," + this.ID;
                    StarFighterScene.gameObjects.Add(bullet.ID, bullet);
                    shootDelay.Reset();
                };

                shootDelay.PeriodicallyDo(shoot);

                Action tt = () =>
                {
                    for (int i = 0; i < 1; i++)
                    {
                        var shock = new Shockwave(Color.Red, new Vector2F(Location.X - Size.Width, Location.Y - Size.Height), 3, 5, 10, velocityVector.Mag(), velocityVector.angle());

                        shock.ID.SetByKeyTo <string, IGameBehavior>(StarFighterScene.gameObjects, shock);
                    }
                };
                shockwaveTiming.PeriodicallyDo(tt);
            }
        }
Ejemplo n.º 3
0
    public void ReleaseShockwave()
    {
        shockwaveClone = Instantiate(shockwave, gameObject.transform.position, gameObject.transform.rotation);
        Vector3 newsize = new Vector3(0, 0, 1);

        gameObject.transform.localScale = newsize;
        targetSize = 0;
    }
Ejemplo n.º 4
0
        public override void UpdateDiscrete()
        {
            if (PlungeStartTime <= 0)
            {
                Human.Velocity.Y += 0.5f;
            }
            double damageIn = Math.Floor(Weapon.Damage * 1.5);

            HandleDamage(damageIn);
            if (Human.OnGround)
            {
                PlungeFinished = true;
                float?floorY = null;
                foreach (var box in Human.World.FindBoxes(Human.Box.Bounds.Offset(0, 1)))
                {
                    if (box.Data is Tile tile)
                    {
                        if (!floorY.HasValue || box.Bounds.Top < floorY)
                        {
                            floorY = box.Bounds.Top;
                        }
                        tile.HandleTileDamage(damageIn);
                    }
                }
                //Console.WriteLine(TaggedVelocity);
                if (!ShockwaveFinished && floorY.HasValue)
                {
                    for (int i = 0; i < ShockwaveCount; i++)
                    {
                        var speed     = 3 + (i >> 1) * 1.25f;
                        var shockwave = new Shockwave(Human.World, new Vector2(Human.Position.X, floorY.Value - (int)(16 * TaggedVelocity / 5) / 2f), TaggedVelocity)
                        {
                            Velocity = new Vector2((-1 + (i & 1) * 2) * speed, 0),
                            FrameEnd = 70,
                            Shooter  = Human
                        };
                    }
                    new ScreenShakeRandom(Human.World, 15, 5);
                    PlaySFX(sfx_explosion1, 1f, 0.01f, 0.2f);
                    new ParryEffect(Human.World, Human.Position, 0, 5);
                    ShockwaveFinished = true;
                }
            }
            else
            {
                if (Human.Velocity.Y > TaggedVelocity)
                {
                    TaggedVelocity = Human.Velocity.Y;
                }
            }
            if (PlungeFinished && PlungeFinishTime <= 0)
            {
                Human.CurrentAction = new ActionIdle(Human);
            }
        }
Ejemplo n.º 5
0
    /// <summary> Creates (or reuses) a shockwave GameObject </summary>
    /// <param name="_position"> Centre position </param>
    /// <param name="_color"> Ripple's colour </param>
    public void StartRipple(Vector3 _position, Color _color)
    {
        GameObject gameObj = RecyclePool.RetrieveOrCreate(RecyclePool.PoolTypes.Shockwave, shockwavePrefab);

        // Set position & rotation
        gameObj.transform.parent     = myTrans;
        gameObj.transform.position   = _position;
        gameObj.transform.localScale = Vector3.zero;

        // (Re)start popup animation
        Shockwave shockwaveScript = gameObj.GetComponent <Shockwave>();

        shockwaveScript.Init(_color);

        shockwaves.Add(shockwaveScript);
    }
Ejemplo n.º 6
0
    public static void Blast (Body exploder) {
        Shockwave shockwave = new Shockwave();

        int x = (exploder.PositionPixel.X / KinematicObstructionGridSize) * KinematicObstructionGridSize;
        int y = (exploder.PositionPixel.Y / KinematicObstructionGridSize) * KinematicObstructionGridSize;

        shockwave.WarpTo(x, y);

        shockwave.TryMove(Directions.Right, ShockwaveVelocity);
        shockwave.WarpTo(x, y);
        shockwave.TryMove(Directions.Up, ShockwaveVelocity);
        shockwave.WarpTo(x, y);
        shockwave.TryMove(Directions.Left, ShockwaveVelocity);
        shockwave.WarpTo(x, y);
        shockwave.TryMove(Directions.Down, ShockwaveVelocity);
    }
Ejemplo n.º 7
0
    public void SpawnShockwaves()
    {
        GameObject left = Instantiate(shockwave);

        left.transform.position = new Vector3(-1f, 1f, -12.5f);
        Shockwave sl = left.GetComponent <Shockwave>();

        sl.rb.velocity = Vector3.left * sl.speed;

        GameObject right = Instantiate(shockwave);

        right.transform.position = new Vector3(1f, 1f, -12.5f);
        Shockwave sr = right.GetComponent <Shockwave>();

        sr.rb.velocity = Vector3.right * sr.speed;
    }
Ejemplo n.º 8
0
    public static void Blast(Body exploder)
    {
        Shockwave shockwave = new Shockwave();

        int x = (exploder.PositionPixel.X / KinematicObstructionGridSize) * KinematicObstructionGridSize;
        int y = (exploder.PositionPixel.Y / KinematicObstructionGridSize) * KinematicObstructionGridSize;

        shockwave.WarpTo(x, y);

        shockwave.TryMove(Directions.Right, ShockwaveVelocity);
        shockwave.WarpTo(x, y);
        shockwave.TryMove(Directions.Up, ShockwaveVelocity);
        shockwave.WarpTo(x, y);
        shockwave.TryMove(Directions.Left, ShockwaveVelocity);
        shockwave.WarpTo(x, y);
        shockwave.TryMove(Directions.Down, ShockwaveVelocity);
    }
Ejemplo n.º 9
0
    public void Special()
    {
        if (pName == "Pedda")
        {
            GameObject obj = Instantiate(skillObj[1], p.spawn.position, Quaternion.identity);
            Tornado    tor = obj.GetComponent <Tornado>();
            tor.transform.rotation = transform.rotation;
            FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_TORNADO);
            FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_TAKE);

            p.anim.SetTrigger("Attacks");
        }
        else if (pName == "Ted Shredder")
        {
            GameObject obj = Instantiate(skillObj[1], p.spawn.position, Quaternion.identity);
            Shockwave  tor = obj.GetComponent <Shockwave>();
            tor.transform.rotation = transform.rotation;
            FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_WAVE);
            FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_TAKE);

            p.anim.SetTrigger("Attacks");
        }
        else if (pName == "Pompf")
        {
            GameObject obj = Instantiate(skillObj[1], transform.position, Quaternion.identity);
            FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_ICE);
            FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_TAKE);

            p.anim.SetTrigger("Attacks");
        }
        else if (pName == "Justin")
        {
            if (skillObj[1].activeSelf == false)
            {
                skillObj[1].SetActive(true);
                skillObj[1].GetComponent <DivineShield>().lifeTime = 5;
                FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_SHIELD);
                FMODUnity.RuntimeManager.PlayOneShot(FMODPaths.POWER_TAKE);
            }

            p.anim.SetTrigger("Attacks");
        }
    }
Ejemplo n.º 10
0
    private float waitCount = 6.0f; // wait count before state transition.

    #endregion Fields

    #region Constructors

    public Ship(Device device, GameClass gameClass, HullColors hullColor)
    {
        this.device = device;
        this.game = gameClass;
        shots = new Shots(device);
        if (hullColor == HullColors.White) {
            shipMesh = new PositionedMesh(device, "WhiteShip.x");
            startingPosition = new Vector3(10, 0, 10);
        }
        else {
            shipMesh = new PositionedMesh(device, "RedShip.x");
            startingPosition = new Vector3(-50, 0, -150);
        }
        vaporTrail = new ParticleEffects(device);
        vaporTrail.ParticleTexture = TextureLoader.FromFile(device,
            MediaUtilities.FindFile("particle-blue.bmp"));
        shockWave = new Shockwave(device);
        SetRandomPosition(true);
    }
Ejemplo n.º 11
0
    private void OnInputDown()
    {
        // Check if occupying piece is null and provide user feedback

        if (occupyingPlayer == null)
        {
            Shockwave shockwave = Instantiate(Services.Prefabs.Shockwave, transform.position, Quaternion.identity);
            shockwave.Init(Services.GameScene.currentPlayer, transform.position);
            SetOccupyingPlayer(Services.GameScene.currentPlayer);
            Services.EventManager.Fire(new PlayMadeEvent(occupyingPlayer, this));
            float pitch = occupyingPlayer.playerNum == 0 ? 0.8f : 2f;
            Services.AudioManager.CreateTrackAndPlay(Clips.PLACE, pitch);
        }

        Services.EventManager.Register <TouchUp>(OnTouchUp);
        Services.EventManager.Register <MouseUp>(OnMouseUp);

        Services.EventManager.Unregister <TouchDown>(OnTouchDown);
        Services.EventManager.Unregister <MouseDown>(OnMouseDown);
    }
Ejemplo n.º 12
0
 public Ship(Device device, GameClass gameClass, HullColors hullColor)
 {
     this.device = device;
     this.game   = gameClass;
     shots       = new Shots(device);
     if (hullColor == HullColors.White)
     {
         shipMesh         = new PositionedMesh(device, "WhiteShip.x");
         startingPosition = new Vector3(10, 0, 10);
     }
     else
     {
         shipMesh         = new PositionedMesh(device, "RedShip.x");
         startingPosition = new Vector3(-50, 0, -150);
     }
     vaporTrail = new ParticleEffects(device);
     vaporTrail.ParticleTexture = TextureLoader.FromFile(device,
                                                         MediaUtilities.FindFile("particle-blue.bmp"));
     shockWave = new Shockwave(device);
     SetRandomPosition(true);
 }
Ejemplo n.º 13
0
        public Magnus(Unit9 owner, MultiSleeper abilitySleeper, Sleeper orbwalkSleeper, ControllableUnitMenu menu)
            : base(owner, abilitySleeper, orbwalkSleeper, menu)
        {
            this.ComboAbilities = new Dictionary <AbilityId, Func <ActiveAbility, UsableAbility> >
            {
                { AbilityId.magnataur_shockwave, x => this.shockwave = new Shockwave(x) },
                {
                    AbilityId.magnataur_skewer, x =>
                    {
                        this.skewer = new Skewer(x);
                        this.polarity?.AddSkewer(this.skewer);
                        return(this.skewer);
                    }
                },
                {
                    AbilityId.magnataur_reverse_polarity, x =>
                    {
                        this.polarity = new ReversePolarity(x);
                        if (this.skewer != null)
                        {
                            this.polarity.AddSkewer(this.skewer);
                        }

                        return(this.polarity);
                    }
                },

                { AbilityId.item_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_swift_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_arcane_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_overwhelming_blink, x => this.blink = new BlinkDaggerMagnus(x) },
                { AbilityId.item_force_staff, x => this.force = new ForceStaff(x) },
                { AbilityId.item_shivas_guard, x => this.shiva = new ShivasGuard(x) },
                { AbilityId.item_refresher, x => this.refresher = new UntargetableAbility(x) },
                { AbilityId.item_refresher_shard, x => this.refresherShard = new UntargetableAbility(x) },
            };

            this.MoveComboAbilities.Add(AbilityId.magnataur_skewer, x => this.moveSkewer = new BlinkAbility(x));
        }
Ejemplo n.º 14
0
 /// <summary> Called from a shockwave when it finishes growing + fading </summary>
 /// <param name="_shockwave"> Shockwave that just finished </param>
 public void ShockwaveFinished(Shockwave _shockwave)
 {
     RecyclePool.Recycle(RecyclePool.PoolTypes.Shockwave, _shockwave.gameObject);
     shockwaves.Remove(_shockwave);
 }
Ejemplo n.º 15
0
        /// <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.
            this.spriteBatch = new SpriteBatch(this.graphics.GraphicsDevice);

            // Initialize font
            this.font = new FontManager(this.Content, this.spriteBatch);

            // Initialize help
            this.help = new HelpManager(this.input, this.font);

            // Load background
            this.background = new Background(this.Content, this.GraphicsDevice, this.spriteBatch);

            // Load shockwave effect
            this.shockwave = new Shockwave(this.Content, this.GraphicsDevice, this.spriteBatch, this.input);

            // Load image distortion effect
            this.imageDistortion = new ImageDistortion(this.Content, this.GraphicsDevice, this.spriteBatch, this.input);

            // Load sine wave effect
            this.sineWaveDistortion = new SineWaveDistortion(this.Content, this.GraphicsDevice, this.spriteBatch, this.input);
        }
    void Awake()
    {
        characterController = GetComponent<RUISCharacterController>();
        jumpGesture = GetComponentInChildren<RUISJumpGestureRecognizer>();
        shockwaveGesture = GetComponentInChildren<Shockwave>();
        tposeGesture = GetComponentInChildren<RUISTposeGestureRecognizer>();
        //futureGesture = GetComponentInChildren<FutureGestureRecognizer>();
        //seeing = futureGesture.seeing;
        moveWrapper = FindObjectOfType(typeof(PSMoveWrapper)) as PSMoveWrapper;

        try
        {
            Input.GetAxis("Sprint");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Sprint' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Turn");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Turn' not defined in Unity Input settings");
        }

        try
        {
            Input.GetAxis("Jump");
        }
        catch (UnityException)
        {
            Debug.LogWarning("'Jump' not defined in Unity Input settings");
        }
    }