Esempio n. 1
0
        protected virtual int HandleNetworkShipCollision(CollisionDataObject other, Vector2 normal)
        {
            var shipData = (ShipBodyDataObject)other;

            if (_bodyData.FiringObj.IsBodyValid && shipData.Ship.IsBodyValid)
            {
                Ship firingShip = (Ship)_bodyData.FiringObj;
                Ship otherShip  = shipData.Ship;



                if (firingShip != otherShip &&
                    !firingShip.OnSameTeam(otherShip) && otherShip.CurrentHealth > 0)
                {
                    _collisionManager.ReportCollision(otherShip.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);
                    otherShip.Pilot.HitByTargetable(firingShip);

                    TerminationEffect = ParticleEffectType.LaserWaveEffect;


                    Terminate();
                    return(0);
                }
            }

            return(0);
        }
Esempio n. 2
0
        public void UpdateBorder(int SizeOfSystem)
        {
            sizeOfSystem = SizeOfSystem;
            //Console.WriteLine("Setting size of system to " + SizeOfSystem);
            if (Border.Body != null && _physicsManager.World.BodyList.Contains(Border.Body))
            {
                Debugging.DisposeStack.Push(this.ToString());
                Border.Body.Dispose();
            }
            borderList.Clear();

            Vertices verts = Boundaries.CreateConcaveSemiCircle(SizeOfSystem / 100f, SizeOfSystem / 100);

            foreach (Vector2 v in verts)
            {
                borderList.Add(v);
            }



            Border = new PlanetBorder();
            var tempbd = new CollisionDataObject(Border, BodyTypes.WallTile);

            Debugging.AddStack.Push(this.ToString());
            Border.Body                 = BodyFactory.CreateLoopShape(_physicsManager.World, verts, Vector2.Zero, tempbd);
            Border.Body.IsStatic        = true;
            Border.Body.UserData        = tempbd;
            Border.Body.SleepingAllowed = true;
            Border.Body.Friction        = 0f;
            Border.Body.Restitution     = 0.2f;
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the collision appropriately.
        /// Returns 0 if the raycast should be terminated
        /// Returns 1 if the raycast should not be terminated
        /// </summary>
        /// <returns></returns>
        protected virtual int HandleCollision(CollisionDataObject colideeObjectData, Vector2 normal)
        {
            if (colideeObjectData.Object.Enabled == false)//Ignore the collision if the body is disabled
            {
                return(1);
            }


            switch (((CollisionDataObject)colideeObjectData).BodyType)
            {
            case BodyTypes.PlayerShip:
                return(HandlePlayerCollision(colideeObjectData, normal));

            case BodyTypes.Sun:
                return(HandleSunCollision());

            case BodyTypes.NetworkShip:
                return(HandleNetworkShipCollision(colideeObjectData, normal));

            case BodyTypes.Turret:
                return(HandleTurretCollision(colideeObjectData, normal));

            case BodyTypes.WarpHole:
                return(HandleWarpholeCollision(colideeObjectData, normal));

            case BodyTypes.Missile:
                return(HandleMissileCollision(colideeObjectData, normal));

            default:
                return(HandleDefaultCollision(colideeObjectData, normal));
            }
        }
        protected override int HandleMissileCollision(CollisionDataObject colidee, Vector2 normal)
        {
            IMissile m = (IMissile)(((ProjectileBodyDataObject)(colidee)).Bullet);

            try
            {
                if (((ProjectileBodyDataObject)BodyData).FiringObj is ITeamable && !m.OnSameTeam((ITeamable)((ProjectileBodyDataObject)BodyData).FiringObj))
                {
                    m.Health -= 25;

                    if (m.Health <= 0)
                    {
                        m.Terminate();
                    }

                    Terminate();
                    return(0);
                }
                return(1);
            }
            catch (Exception e)
            {
                ConsoleManager.WriteLine("Error during collision between LaserWave and Missile: ", ConsoleMessageType.Error);
                ConsoleManager.WriteLine(e.ToString(), ConsoleMessageType.Error);
                return(1);
            }
        }
Esempio n. 5
0
        protected virtual bool HandleCollision(CollisionDataObject colideeObjectData)
        {
            switch (((CollisionDataObject)colideeObjectData).BodyType)
            {
            case BodyTypes.PlayerShip:
                return(HandlePlayerCollision(colideeObjectData));

            case BodyTypes.Sun:
                return(HandleSunCollision());

            case BodyTypes.NetworkShip:
                return(HandleNetworkShipCollision(colideeObjectData));

            case BodyTypes.Turret:
                return(HandleTurretCollision(colideeObjectData));

            case BodyTypes.WarpHole:
                return(HandleWarpholeCollision(colideeObjectData));

            case BodyTypes.Missile:
                return(HandleMissileCollision(colideeObjectData));

            default:
                return(HandleDefaultCollision(colideeObjectData));
            }
        }
Esempio n. 6
0
        public NPCPilot(Ship ship, CollisionDataObject userdata)
        {
            PilotType = PilotType.NPC;
            Ship      = ship;

            _coroutineManager = new CoroutineManager();

            ship.SetPilotData(userdata, false);
        }
        protected override int HandleCollision(CollisionDataObject colideeObjectData, Vector2 normal)
        {
            base.HandleCollision(colideeObjectData, normal);

            if (colideeObjectData.BodyType == BodyTypes.PlayerShip)
            {
                //Pass through player ship
                return(1);
            }
            else
            {
                Terminate();
                return(0);//Always terminate
            }
        }
        /// <summary>
        /// Handles the player collision.
        /// Returns false if the projectile is terminated, true otherwise
        /// </summary>
        /// <param name="colidee">The colidee.</param>
        /// <returns></returns>
        protected override int HandlePlayerCollision(CollisionDataObject colidee, Vector2 normal)
        {
            var shipData = (ShipBodyDataObject)colidee;

            Turret T = (Turret)_bodyData.FiringObj;


            Ship playerShip = shipData.Ship;

            if (_turretType == TurretTypes.Planet)
            {
                if (!playerShip.OnSameTeam(T))
                {
                    _collisionManager.ReportCollision(playerShip.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);


                    TerminationEffect = ParticleEffectType.LaserWaveEffect;

                    Terminate();
                    return(0);
                }
                else
                {
                    return(1);
                }
            }

            // If the firing turret and the player are on different teams and the player is not currently dead
            else if (((PlayerPilot)playerShip.Pilot).IsAlive && !T.OnSameTeam(playerShip))
            {
                _collisionManager.ReportCollision(playerShip.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);


                TerminationEffect = ParticleEffectType.LaserWaveEffect;

                Terminate();
                return(0);
            }
            else
            {
                return(1);
            }
        }
Esempio n. 9
0
        protected virtual int HandleTurretCollision(CollisionDataObject colidee, Vector2 normal)
        {
            Ship   firingShip = (Ship)_bodyData.FiringObj;
            Turret turret     = (Turret)((StructureBodyDataObject)colidee).Structure;


            if (turret.TurretType == TurretTypes.Planet)
            {
                if (!firingShip.OnSameTeam(turret))
                {
                    _collisionManager.ReportCollision(turret.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);


                    TerminationEffect = ParticleEffectType.LaserWaveEffect;

                    Terminate();
                    return(0);
                }
                else
                {
                    return(1);
                }
            }

            // If the firing turret and the player are on different teams and the player is not currently dead
            if (!turret.OnSameTeam(firingShip))
            {
                _collisionManager.ReportCollision(turret.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);


                TerminationEffect = ParticleEffectType.LaserWaveEffect;

                Terminate();
                return(0);
            }
            else
            {
                return(1);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Handles the player collision.
        /// Returns false if the projectile is terminated, true otherwise
        /// </summary>
        /// <param name="colidee">The colidee.</param>
        /// <returns></returns>
        protected virtual int HandlePlayerCollision(CollisionDataObject colidee, Vector2 normal)
        {
            var shipData = (ShipBodyDataObject)colidee;



            if (_bodyData.FiringObj is Ship)
            {
                if (_bodyData.FiringObj.IsBodyValid && shipData.Ship.IsBodyValid)
                {
                    Ship playerShip = shipData.Ship;
                    Ship firingShip = (Ship)_bodyData.FiringObj;

                    // If the laser is not from the playerShip, and the player is not currently dead
                    if (firingShip != playerShip &&
                        ((PlayerPilot)playerShip.Pilot).IsAlive && !firingShip.OnSameTeam(playerShip))
                    {
                        _collisionManager.ReportCollision(playerShip.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);

                        playerShip.Pilot.CurrentTarget = firingShip;

                        TerminationEffect = ParticleEffectType.LaserWaveEffect;

                        Terminate();
                        return(0);
                    }
                }
            }
            else if (_bodyData.FiringObj is Turret)
            {
                //This should never happen, since we have a separate LaserTurret
                Turret t = (Turret)_bodyData.FiringObj;
                //t.ReportCollision()
                Terminate();
                return(0);
            }


            return(1);
        }
        protected override int HandleNetworkShipCollision(CollisionDataObject other, Vector2 normal)
        {
            var shipData = (ShipBodyDataObject)other;

            Turret firingTurret = (Turret)_bodyData.FiringObj;
            Ship   hitShip      = shipData.Ship;

            if (_turretType == TurretTypes.Planet)
            {
                if (!hitShip.OnSameTeam(firingTurret))
                {
                    _collisionManager.ReportCollision(hitShip.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);

                    hitShip.Pilot.HitByTargetable(firingTurret);

                    TerminationEffect = ParticleEffectType.LaserWaveEffect;

                    Terminate();
                    return(0);
                }

                return(1);
            }
            else if (!firingTurret.OnSameTeam(hitShip) && hitShip.CurrentHealth > 0)
            {
                _collisionManager.ReportCollision(hitShip.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);

                hitShip.CurrentTarget = firingTurret;

                hitShip.Pilot.HitByTargetable(firingTurret);

                TerminationEffect = ParticleEffectType.LaserWaveEffect;

                Terminate();

                return(0);
            }

            return(1);
        }
        protected override int HandleTurretCollision(CollisionDataObject colidee, Vector2 normal)
        {
            Turret firingTurret = (Turret)_bodyData.FiringObj;
            Turret hitTurret    = (Turret)((StructureBodyDataObject)colidee).Structure;

            if (_turretType == TurretTypes.Planet)
            {
                return(1);//Do nothing, we currently only allow allied turrets on a planet
            }
            else if (!hitTurret.OnSameTeam(firingTurret))
            {
                _collisionManager.ReportCollision(hitTurret.Id, Id, Stats.ProjectileType, 0, FiringWeaponSlot);


                TerminationEffect = ParticleEffectType.LaserWaveEffect;
                Terminate();
                return(0);
            }
            else
            {
                return(1);
            }
        }
Esempio n. 13
0
        public GravityBombProjectile(CollisionManager collisionManager, ParticleManager particleManager, Vector2 velocity, ICanFire firingObj, World world, int id, byte firingWeaponSlot, Vector2 position)
            : base(collisionManager, id, firingWeaponSlot)
        {
            _particleManager = particleManager;
            Debugging.AddStack.Push(this.ToString());
            Body                = BodyFactory.CreateCircle(world, 1, 1);
            Body.UserData       = new ProjectileBodyDataObject(BodyTypes.Projectile, id, firingObj, this);
            Body.OnCollision   += Body_OnCollision;
            Body.LinearVelocity = velocity;



            _gravityObject = new GravityObject(position, Stats.InitialGravityVal);
            bodiesInArea   = new List <Body>();

            //This is kind of cheating, but it should be OK for now. Just make sure to check if the body is valid (check body.IsDisposed) before doing anything with it to avoid farseer exceptions
            foreach (Body b in world.BodyList)
            {
                CollisionDataObject bdo = b.UserData as CollisionDataObject;

                if (bdo != null)
                {
                    if (bdo.BodyType == BodyTypes.Ship || bdo.BodyType == BodyTypes.NetworkShip || bdo.BodyType == BodyTypes.PlayerShip || bdo.BodyType == BodyTypes.Missile)
                    {
                        bodiesInArea.Add(b);
                    }
                }
            }


            flipPoints = new List <float>(Stats.NumFlips);
            for (int i = 0; i < Stats.NumFlips; i++)
            {
                flipPoints.Add(Stats.NonGravityFraction + ((1 - Stats.NonGravityFraction) / Stats.NumFlips * (i + 1)));
            }
        }
        private static void DrawEnvironmentCollisionSettings(ICECreatureControl _control)
        {
            // IMPACT HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();

            EditorGUI.BeginDisabledGroup(_control.Creature.Environment.CollisionHandler.Enabled == false);
            WorldObjectEditor.DrawObjectHeaderLine(ref _control.Creature.Environment.CollisionHandler.Enabled, ref _control.Creature.Environment.CollisionHandler.Foldout, EditorHeaderType.FOLDOUT_BOLD, "Collisions", "");

            _control.Creature.Environment.CollisionHandler.AllowChildCollisions = ICEEditorLayout.CheckButtonSmall("ACC", "Allow Child Collisions", _control.Creature.Environment.CollisionHandler.AllowChildCollisions);
            _control.Creature.Environment.CollisionHandler.UseCollider          = ICEEditorLayout.CheckButtonSmall("COL", "Use Collider events", _control.Creature.Environment.CollisionHandler.UseCollider);
            _control.Creature.Environment.CollisionHandler.UseTrigger           = ICEEditorLayout.CheckButtonSmall("TRI", "Use Trigger events", _control.Creature.Environment.CollisionHandler.UseTrigger);
            EditorGUI.BeginDisabledGroup(_control.GetComponent <CharacterController>() == null);
            _control.Creature.Environment.CollisionHandler.UseCharacterController = ICEEditorLayout.CheckButtonSmall("CON", "Use CharacterController events", _control.Creature.Environment.CollisionHandler.UseCharacterController);
            EditorGUI.EndDisabledGroup();
            GUILayout.Space(5);
            EditorGUI.EndDisabledGroup();

            if (ICEEditorLayout.AddButton("Adds a new collision rule"))
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Enabled = true;
            }

            if (ICEEditorLayout.SaveButton("Saves collision data to file"))
            {
                CreatureEditorIO.SaveEnvironmentCollisionToFile(_control.Creature.Environment.CollisionHandler, _control.gameObject.name);
            }
            if (ICEEditorLayout.LoadButton("Loads collision data  to file"))
            {
                _control.Creature.Environment.CollisionHandler = CreatureEditorIO.LoadEnvironmentCollisionFromFile(_control.Creature.Environment.CollisionHandler);
            }
            if (ICEEditorLayout.ResetButton("Resets the collision data"))
            {
                _control.Creature.Environment.CollisionHandler.Reset();
            }

            _control.Creature.Environment.CollisionHandler.Enabled = ICEEditorLayout.EnableButton(_control.Creature.Environment.CollisionHandler.Enabled);
            ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION);
            // IMPACT HEADER END

            if (_control.Creature.Environment.CollisionHandler.Enabled == true && _control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Foldout = true;
            }

            // CONTENT BEGIN
            if (WorldObjectEditor.BeginObjectContentOrReturn(EditorHeaderType.FOLDOUT_BOLD, _control.Creature.Environment.CollisionHandler))
            {
                return;
            }

            for (int i = 0; i < _control.Creature.Environment.CollisionHandler.Collisions.Count; i++)
            {
                CollisionDataObject _collision = _control.Creature.Environment.CollisionHandler.Collisions[i];

                if (_collision != null)
                {
                    if (_collision.Name.Trim() == "")
                    {
                        _collision.Name = "Collision Rule #" + (i + 1);
                    }

                    // IMPACT RULE HEADER BEGIN
                    ICEEditorLayout.BeginHorizontal();
                    EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                    _collision.Foldout = ICEEditorLayout.Foldout(_collision.Foldout, _collision.Name);
                    EditorGUI.EndDisabledGroup();

                    if (ICEEditorLayout.ListDeleteButton <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, _collision, "Removes the selected collision rule"))
                    {
                        if (_control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
                        {
                            _control.Creature.Environment.CollisionHandler.Enabled = false;
                        }
                        return;
                    }

                    GUILayout.Space(5);
                    if (ICEEditorLayout.ListUpDownButtons <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, i))
                    {
                        return;
                    }

                    _collision.Enabled = ICEEditorLayout.EnableButton("Activates/deactivates the selected collision rule", _collision.Enabled);

                    ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE);
                    // IMPACT RULE HEADER END

                    // IMPACT RULE CONTENT BEGIN
                    if (_collision.Foldout)
                    {
                        EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                        ICEEditorLayout.BeginHorizontal();
                        _collision.Name = ICEEditorLayout.Text("Name", "", _collision.Name);
                        if (ICEEditorLayout.ResetButtonSmall())
                        {
                            _collision.Name = "";
                        }
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_NAME);

                        EditorGUILayout.Separator();
                        ICEEditorLayout.BeginHorizontal();
                        ICEEditorLayout.Label("Conditions", true);

                        _collision.UseTag      = ICEEditorLayout.CheckButtonMiddle("TAG", "", _collision.UseTag);
                        _collision.UseLayer    = ICEEditorLayout.CheckButtonMiddle("LAYER", "", _collision.UseLayer);
                        _collision.UseBodyPart = ICEEditorLayout.CheckButtonMiddle("COLLIDER", "", _collision.UseBodyPart);
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_CONDITIONS);
                        EditorGUI.indentLevel++;

                        if (_collision.UseLayer)
                        {
                            _collision.Layer = ICEEditorLayout.Layer("Layer", "Desired collision layer", _collision.Layer, Info.ENVIROMENT_COLLISION_RULE_LAYER);
                        }

                        if (_collision.UseTag)
                        {
                            _collision.Tag = ICEEditorLayout.Tag("Tag", "Desired collision tag", _collision.Tag, Info.ENVIROMENT_COLLISION_RULE_TAG);
                        }

                        if (_collision.UseBodyPart)
                        {
                            _collision.BodyPart = ICEEditorLayout.ColliderPopup(_control.gameObject, "Body Part", "Desired body part", _collision.BodyPart, Info.ENVIROMENT_COLLISION_RULE_BODYPART);
                        }

                        EditorGUI.indentLevel--;

                        EditorGUILayout.Separator();
                        ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_COLLISION_RULE_PROCEDURES);
                        EditorGUI.indentLevel++;
                        _collision.UseBehaviourModeKey = ICEEditorLayout.Toggle("Behaviour", "", _collision.UseBehaviourModeKey, Info.ENVIROMENT_COLLISION_BEHAVIOUR);
                        if (_collision.UseBehaviourModeKey)
                        {
                            EditorGUI.indentLevel++;
                            _collision.BehaviourModeKey = BehaviourEditor.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _collision.BehaviourModeKey, "COLLISION_" + _collision.Name.ToUpper(), Info.ENVIROMENT_COLLISION_BEHAVIOUR);
                            EditorGUI.indentLevel--;
                        }

                        EditorHeaderType _header = EditorHeaderType.TOGGLE;
                        CreatureObjectEditor.DrawInfluenceObject(_collision.Influences, _header, _control.Creature.Status.UseAdvanced, _control.Creature.Status.InitialDurabilityMax, Info.ENVIROMENT_COLLISION_INFLUENCES);
                        //CreatureObjectEditor.DrawAudioObject( _collision.Audio, _header, Info.ENVIROMENT_COLLISION_AUDIO );
                        //CreatureObjectEditor.DrawEffectObject( _control, _collision.Effect, _header, Info.ENVIROMENT_COLLISION_EFFECT );


                        //_impact.ForceInteraction = EditorGUILayout.Toggle("Force Interaction", _impact.ForceInteraction );
                        EditorGUI.indentLevel--;
                        EditorGUILayout.Separator();


                        EditorGUI.EndDisabledGroup();
                        ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                    }
                    // IMPACT RULE CONTENT END
                }
            }

            ICEEditorLayout.DrawListAddLine <CollisionDataObject>(_control.Creature.Environment.CollisionHandler.Collisions, new CollisionDataObject(), false, "Add Collision Rule");

            WorldObjectEditor.EndObjectContent();
            // CONTENT END
        }
Esempio n. 15
0
 public NetworkPilot(Ship ship, CollisionDataObject userdata)
 {
     PilotType = PilotType.NetworkPlayer;
     Ship      = ship;
     ship.SetPilotData(userdata, true);
 }
        private static void DrawEnvironmentCollisionSettings(ICECreatureControl _control)
        {
            // IMPACT HEADER BEGIN
            ICEEditorLayout.BeginHorizontal();
            _control.Creature.Environment.CollisionHandler.Enabled = ICEEditorLayout.ToggleLeft("Collisions", "", _control.Creature.Environment.CollisionHandler.Enabled, true);
            if (GUILayout.Button(new GUIContent("ADD", "add a new impact rule"), ICEEditorStyle.ButtonMiddle))
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Add(new CollisionDataObject());
                _control.Creature.Environment.CollisionHandler.Enabled = true;
            }
            if (GUILayout.Button(new GUIContent("RESET", "removes all impact rules"), ICEEditorStyle.ButtonMiddle))
            {
                _control.Creature.Environment.CollisionHandler.Collisions.Clear();
            }
            ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION);
            // IMPACT HEADER END

            if (_control.Creature.Environment.CollisionHandler.Collisions.Count == 0)
            {
                _control.Creature.Environment.CollisionHandler.Enabled = false;
            }

            // IMPACT CONTENT BEGIN
            EditorGUI.BeginDisabledGroup(_control.Creature.Environment.CollisionHandler.Enabled == false);
            EditorGUI.indentLevel++;
            for (int i = 0; i < _control.Creature.Environment.CollisionHandler.Collisions.Count; i++)
            {
                CollisionDataObject _collision = _control.Creature.Environment.CollisionHandler.Collisions[i];

                if (_collision != null)
                {
                    string _title = _collision.Name;
                    if (_title == "")
                    {
                        _title = "Collision Rule #" + (i + 1);

                        if (_collision.TagPriority > 0)
                        {
                            if (_title != "")
                            {
                                _title += " ";
                            }

                            _title += "T:" + _collision.Tag;
                        }

                        if (_collision.LayerPriority > 0)
                        {
                            if (_title != "")
                            {
                                _title += " ";
                            }

                            _title += "L:" + LayerMask.LayerToName(_collision.Layer);
                        }

                        _collision.Name = _title;
                    }

                    // IMPACT RULE HEADER BEGIN
                    ICEEditorLayout.BeginHorizontal();
                    _collision.Foldout = ICEEditorLayout.Foldout(_collision.Foldout, _collision.Name);
                    _collision.Enabled = ICEEditorLayout.ButtonCheck("ACTIVE", "activates/deactivates the selected collision rule", _collision.Enabled, ICEEditorStyle.ButtonMiddle);

                    if (GUILayout.Button(new GUIContent("REMOVE", "removes the selected collision rule"), ICEEditorStyle.ButtonMiddle))
                    {
                        _control.Creature.Environment.CollisionHandler.Collisions.Remove(_collision);
                        return;
                    }
                    ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE);
                    // IMPACT RULE HEADER END

                    // IMPACT RULE CONTENT BEGIN
                    if (_collision.Foldout)
                    {
                        EditorGUI.BeginDisabledGroup(_collision.Enabled == false);
                        ICEEditorLayout.BeginHorizontal();
                        _collision.Name = ICEEditorLayout.Text("Name", "", _collision.Name);
                        if (GUILayout.Button(new GUIContent("CLR", ""), ICEEditorStyle.CMDButtonDouble))
                        {
                            _collision.Name = "";
                        }
                        ICEEditorLayout.EndHorizontal(Info.ENVIROMENT_COLLISION_RULE_NAME);

                        EditorGUILayout.Separator();
                        ICEEditorLayout.Label("Conditions", true, Info.ENVIROMENT_COLLISION_RULE_CONDITIONS);
                        EditorGUI.indentLevel++;

                        _collision.Type = (CollisionConditionType)ICEEditorLayout.EnumPopup("Type", "Collision ", _collision.Type, Info.ENVIROMENT_COLLISION_RULE_TYPE);

                        if (_collision.Type == CollisionConditionType.LAYER)
                        {
                            _collision.TagPriority = 0;
                        }
                        else if (_collision.Type == CollisionConditionType.LAYER)
                        {
                            _collision.LayerPriority = 0;
                        }

                        if (_collision.Type == CollisionConditionType.LAYER || _collision.Type == CollisionConditionType.TAG_AND_LAYER)
                        {
                            _collision.Layer = ICEEditorLayout.Layer("Layer", "Desired collision layer", _collision.Layer, Info.ENVIROMENT_COLLISION_RULE_LAYER);
                            EditorGUI.indentLevel++;
                            _collision.LayerPriority = (int)ICEEditorLayout.DefaultSlider("Priority", "", _collision.LayerPriority, 1, 0, 10, 1, Info.ENVIROMENT_COLLISION_RULE_LAYER_PRIORITY);
                            EditorGUI.indentLevel--;
                        }

                        if (_collision.Type == CollisionConditionType.TAG || _collision.Type == CollisionConditionType.TAG_AND_LAYER)
                        {
                            _collision.Tag = ICEEditorLayout.Tag("Tag", "Desired collision tag", _collision.Tag, Info.ENVIROMENT_COLLISION_RULE_TAG);
                            EditorGUI.indentLevel++;
                            _collision.TagPriority = (int)ICEEditorLayout.DefaultSlider("Priority", "", _collision.TagPriority, 1, 0, 10, 1, Info.ENVIROMENT_COLLISION_RULE_TAG_PRIORITY);
                            EditorGUI.indentLevel--;
                        }

                        EditorGUI.indentLevel--;

                        EditorGUILayout.Separator();
                        ICEEditorLayout.Label("Procedures", true, Info.ENVIROMENT_COLLISION_RULE_PROCEDURES);
                        EditorGUI.indentLevel++;
                        //_impact.ForceInteraction = EditorGUILayout.Toggle("Force Interaction", _impact.ForceInteraction );
                        _collision.Influences.Enabled = EditorGUILayout.Toggle("Influences", _collision.Influences.Enabled);
                        _collision.Influences         = EditorSharedTools.DrawShareInfluencesContent(_collision.Influences, Info.ENVIROMENT_COLLISION_INFLUENCES);
                        _collision.BehaviourModeKey   = EditorBehaviour.BehaviourSelect(_control, "Behaviour", "Reaction to this impact", _collision.BehaviourModeKey, "IMPACT_" + _collision.Tag.ToUpper());
                        EditorGUI.indentLevel--;
                        EditorGUILayout.Separator();


                        EditorGUI.EndDisabledGroup();
                        ICEEditorStyle.SplitterByIndent(EditorGUI.indentLevel + 1);
                    }
                    // IMPACT RULE CONTENT END
                }
            }

            EditorGUILayout.Separator();
            EditorGUI.indentLevel--;
            EditorGUI.EndDisabledGroup();
        }
Esempio n. 17
0
 protected virtual bool HandleDefaultCollision(CollisionDataObject colidee)
 {
     return(true);
 }
Esempio n. 18
0
 protected virtual bool HandleMissileCollision(CollisionDataObject colidee)
 {
     //Do nothing
     return(false);
 }
Esempio n. 19
0
 protected virtual bool HandleTurretCollision(CollisionDataObject colidee)
 {
     return(false);
 }
Esempio n. 20
0
 protected virtual int HandleDefaultCollision(CollisionDataObject colidee, Vector2 normal)
 {
     ReflectAcrossNormal(normal);
     return(0);
 }
Esempio n. 21
0
 protected virtual int HandleMissileCollision(CollisionDataObject colidee, Vector2 normal)
 {
     //Do nothing
     return(0);
 }
Esempio n. 22
0
 protected virtual bool HandleNetworkShipCollision(CollisionDataObject other)
 {
     return(false);
 }
Esempio n. 23
0
 public void SetPilotData(CollisionDataObject userdata, bool ignoreGravity)
 {
     SetUserData(userdata);
     Body.OnCollision  += body_OnCollision;
     Body.IgnoreGravity = ignoreGravity;
 }