public void Launch()
        {
            if (!_spawning)
            {
                if (_body.Position.Y < Pax4ActorWorld._fudgeFactor / _destroyLowerThresholdFactor)
                {
                    Dx();
                }
                else if ((Pax4WorldLavaAndIce._missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._ICE ||
                          Pax4WorldLavaAndIce._missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE) &&
                         Pax4UiStateLavaAndIceMission._currentMissionState._fg &&
                         Pax4Touch._current._currentTouchState._oneTouch == true &&
                         !_launched &&
                         Pax4UiStateLavaAndIceMission._currentMissionState._iceLauncher._toggle &&
                         Pax4Touch._current._currentTouchState._xy.Y > _tapLaunchThreshold &&
                         !Pax4UiStateLavaAndIceMission._currentMissionState._iceLauncher.Touched())
                {
                    if (Pax4UiStateLavaAndIceMission._currentMissionState._lavaLauncher == null ||
                        (Pax4UiStateLavaAndIceMission._currentMissionState._lavaLauncher != null &&
                         !Pax4UiStateLavaAndIceMission._currentMissionState._lavaLauncher.Touched())
                        )
                    {
                        Vector3 _playerAmmoImpulse = Pax4Tools.WorldToScreen(_body.Position) - Pax4Touch._current._currentTouchState._xy;
                        _playerAmmoImpulse.X = -_playerAmmoImpulse.X;

                        DisableConstraint();

                        _playerAmmoImpulse.Normalize();
                        _playerAmmoImpulse *= _playerAmmoMaxImpulseLength;

                        _body.ApplyBodyWorldImpulse(_playerAmmoImpulse, Vector3.Zero);

                        if (_actorPowerUp == EActorPowerUp._DURABILITY)
                        {
                            ((Pax4SoundLavaAndIce)Pax4Sound._current)._lavaandiceIceLaunch1.Play();
                        }
                        else
                        {
                            ((Pax4SoundLavaAndIce)Pax4Sound._current)._lavaandiceIceLaunch.Play();
                        }

                        _launched = true;//false this for remote control
                    }
                }
            }
            else
            {
                if (_body.Position.Y >= Pax4ActorWorld._fudgeFactor / _destroyLowerThresholdFactor)
                {
                    _spawning = false;
                }
            }
        }
        public virtual void TriggerWorldToScreen()
        {
            if (_disabled || _particleEffectProxy == null)
            {
                return;
            }

            Vector3 effectPosition = Pax4Tools.WorldToScreen(_objectSceneryPart.GetPosition());

            for (int i = 0; i < _particleEffectProxy.Effect.Emitters.Count; i++)
            {
                ((TriggerOffsetController)_particleEffectProxy.Effect.Emitters[i].Controllers[0]).TriggerOffset = effectPosition;
            }

            _particleEffectProxy.Trigger();
        }
        public virtual void Trigger(bool p_randomOffset, float p_offsetMax = 0.0f)
        {
            if (_disabled || _particleEffectProxy == null || _objectSceneryPart == null)
            {
                return;
            }

            Vector3 effectPosition = Pax4Tools.WorldToScreen(_objectSceneryPart.GetPosition());

            if (p_randomOffset)
            {
                effectPosition += RandomUtil.NextUnitVector3() * p_offsetMax * Pax4Camera._current._scale;
            }

            for (int i = 0; i < _particleEffectProxy.Effect.Emitters.Count; i++)
            {
                ((TriggerOffsetController)_particleEffectProxy.Effect.Emitters[i].Controllers[0]).TriggerOffset = effectPosition;
            }

            _particleEffectProxy.Trigger();
        }
Beispiel #4
0
        public virtual bool HandleCollisionDetection(CollisionSkin p_this, CollisionSkin p_other)
        {
            if (_dxRequested)
            {
                return(false);
            }

            Pax4ObjectPhysicsPart other = (Pax4ObjectPhysicsPart)p_other._pax4Object;

            if (((Pax4Actor)other)._actorType == EActorType._WORLD)
            {
                return(true);
            }

            Vector3 effectPosition = Pax4Tools.WorldToScreen(other._body.Position);

            if (((Pax4Actor)other)._actorType != EActorType._PLAYER)
            {
                if (this._actorElementType != ((Pax4Actor)other)._actorElementType)
                {
                    this._health -= _normalHealthStep;
                    if (this._health <= 0.0f)
                    {
                        this.RequestDx();
                    }

                    if (this._actorPowerUp == EActorPowerUp._DURABILITY)
                    {
                        if (this._actorElementType == EActorType._LAVA)
                        {
                            ((Pax4SoundLavaAndIce)Pax4Sound._current)._lavaandiceBurning1.Play();
                        }
                        else if (this._actorElementType == EActorType._ICE)
                        {
                            ((Pax4SoundLavaAndIce)Pax4Sound._current)._lavaandiceFreezing1.Play();
                        }

                        return(HandleCollisionDetectionOther(effectPosition, (Pax4Actor)other, _durabilityHealthStep));
                    }
                    else if (this._actorPowerUp == EActorPowerUp._NORMAL)
                    {
                        if (((Pax4Actor)other)._actorPowerUp != EActorPowerUp._NULL && ((Pax4Actor)other)._actorClassType == EActorType._AMMO)
                        {
                            if (this == Pax4ActorPlayerAmmoLava._current)
                            {
                                Pax4ActorPlayerAmmoLava._powerUp = ((Pax4Actor)other)._actorPowerUp;
                            }
                            else if (this == Pax4ActorPlayerAmmoIce._current)
                            {
                                Pax4ActorPlayerAmmoIce._powerUp = ((Pax4Actor)other)._actorPowerUp;
                            }
                        }

                        return(HandleCollisionDetectionOther(effectPosition, (Pax4Actor)other, _normalHealthStep));
                    }
                }
                else// (this._actorElementType == other._actorElementType)
                {
                    if (this._actorElementType == EActorType._LAVA)
                    {
                        ((Pax4SoundLavaAndIce)Pax4Sound._current)._lavaandiceBurning.Play();
                    }
                    else if (this._actorElementType == EActorType._ICE)
                    {
                        ((Pax4SoundLavaAndIce)Pax4Sound._current)._lavaandiceFreezing.Play();
                    }

                    this._health -= _similarHealthStep;
                    if (this._health <= 0.0f)
                    {
                        this.RequestDx();
                    }

                    if (_similarHealthStep >= 1.0f)
                    {
                        return(HandleCollisionDetectionOther(effectPosition, (Pax4Actor)other, _durabilityHealthStep));
                    }
                    else if (this._actorPowerUp == EActorPowerUp._DURABILITY)
                    {
                        return(false);
                    }
                }
            }
            else if (((Pax4Actor)other)._actorType == EActorType._PLAYER &&
                     Pax4ActorPlayerAmmoLava._current._launched &&
                     Pax4ActorPlayerAmmoIce._current._launched)
            {
                ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScore300.Trigger(ref effectPosition);
                ((Pax4ParticleEffectLavaAndIce)Pax4ParticleEffect._current)._particleEffectScoreHelpingHand.Trigger(ref effectPosition);

                Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Ini(((Pax4WorldLavaAndIce)Pax4World._current)._score, ((Pax4WorldLavaAndIce)Pax4World._current)._score + 300, true, 1.0f);
                Pax4UiStateLavaAndIceMission._currentMissionState._scoreSpriteModifier.Trigger();
                ((Pax4WorldLavaAndIce)Pax4World._current)._score += 300;
            }

            return(true);
        }