void DropdownValueChangedHandler(Dropdown dropdown)
    {
        if (dropdown.value == 0)
        {
            _collisionObjectType = CollisionObjectType.StaticCollider;
        }
        else if (dropdown.value == 1)
        {
            _collisionObjectType = CollisionObjectType.RigidbodyCollider;
        }
        else if (dropdown.value == 2)
        {
            _collisionObjectType = CollisionObjectType.KinematicRigidbodyCollider;
        }
        else if (dropdown.value == 3)
        {
            _collisionObjectType = CollisionObjectType.StaticTriggerCollider;
        }
        else if (dropdown.value == 4)
        {
            _collisionObjectType = CollisionObjectType.RigidbodyTriggerCollider;
        }
        else if (dropdown.value == 5)
        {
            _collisionObjectType = CollisionObjectType.KinematicRigidbodyTriggerCollider;
        }

        SelectCollisionObjectType();
    }
Esempio n. 2
0
    void ICollisionHandler.CollidedWith(CollisionObjectType objectType)
    {
        if (!isActivePlaythrough || invincibleTimeLeft > 0)
        {
            return;
        }

        if (lives > 0)
        {
            lives--;

            ApplySpriteByLives();

            if (lives == 0)
            {
                Died();
            }
            else
            {
                LostLife(objectType);
                this.invincibleTimeLeft     = CooldownAfterHitSec;
                crewCapsuleCollider.enabled = false;
            }
        }
    }
Esempio n. 3
0
 protected BasePhysObject()
 {
     Shape = PhysicShape.None;
     Type  = CollisionType.None;
     _currentCollisions = new List <BasePhysObject>();
     _prevCollisions    = new List <BasePhysObject>();
     Style = TriggerStyle.None;
     CollisionObjectType = CollisionObjectType.Static;
     ParentPhysics       = null;
 }
Esempio n. 4
0
    void ICollisionHandler.CollidedWith(CollisionObjectType objectType)
    {
        if (spriteRenderer.isVisible)
        {
            var noSoundAfterLength = 30f;
            var volume             = (noSoundAfterLength - Mathf.Clamp(transform.position.magnitude, 0f, noSoundAfterLength)) / noSoundAfterLength;
            sfxPlayer.PlayLaserHit(volume);
        }

        Destroy(gameObject);
    }
Esempio n. 5
0
 /// <summary>
 /// Resets the collision object. (For internal use only.)
 /// </summary>
 internal void ResetInternal()
 {
     Changed          = true;
     CollisionGroup   = 0;
     _domain          = null;
     Enabled          = true;
     _geometricObject = null;
     _type            = CollisionObjectType.Default;
     _shapeType       = ShapeType.Default;
     _shape           = null;
     ShapeTypeChanged = true;
 }
Esempio n. 6
0
        //--------------------------------------------------------------
        #region Methods
        //--------------------------------------------------------------

        #region ----- Internal -----

        // The following methods are used internally by the collision detection to make direct
        // changes to a CollisionObject during collision checks.

        /// <summary>
        /// Copies the data from the specified <see cref="CollisionObject"/> and sets the specified
        /// <see cref="IGeometricObject"/>. (For internal use only.)
        /// </summary>
        /// <param name="collisionObject">The collision object.</param>
        /// <param name="geometricObject">The geometric object.</param>
        internal void SetInternal(CollisionObject collisionObject, IGeometricObject geometricObject)
        {
            Changed          = collisionObject.Changed;
            CollisionGroup   = collisionObject.CollisionGroup;
            _domain          = collisionObject._domain;
            Enabled          = collisionObject.Enabled;
            _geometricObject = geometricObject;
            _type            = collisionObject._type;
            _shapeType       = collisionObject._shapeType;
            _shape           = geometricObject.Shape;
            ShapeTypeChanged = collisionObject.ShapeTypeChanged;
        }
    public IO.Swagger.Model.ObjectTypeMeta CreateObjectTypeMeta(CollisionObjectType collisionObjectType)
    {
        string name;

        IO.Swagger.Model.ObjectModel          objectModel = new IO.Swagger.Model.ObjectModel();
        IO.Swagger.Model.ObjectTypeMeta       objectTypeMeta;
        IO.Swagger.Model.ObjectModel.TypeEnum modelType = new IO.Swagger.Model.ObjectModel.TypeEnum();
        switch (collisionObjectType)
        {
        case CollisionObjectType.Cube:
            name      = SceneManager.Instance.GetFreeObjectTypeName("Cube");
            modelType = IO.Swagger.Model.ObjectModel.TypeEnum.Box;
            decimal sizeX            = 0.1m;
            decimal sizeY            = 0.1m;
            decimal sizeZ            = 0.1m;
            IO.Swagger.Model.Box box = new IO.Swagger.Model.Box(name, sizeX, sizeY, sizeZ);
            objectModel.Box = box;
            break;

        case CollisionObjectType.Sphere:
            name      = SceneManager.Instance.GetFreeObjectTypeName("Sphere");
            modelType = IO.Swagger.Model.ObjectModel.TypeEnum.Sphere;
            decimal radius = 0.1m;
            IO.Swagger.Model.Sphere sphere = new IO.Swagger.Model.Sphere(name, radius);
            objectModel.Sphere = sphere;
            break;

        case CollisionObjectType.Cylinder:
            name      = SceneManager.Instance.GetFreeObjectTypeName("Cylinder");
            modelType = IO.Swagger.Model.ObjectModel.TypeEnum.Cylinder;
            decimal cylinderRadius             = 0.1m;
            decimal cylinderHeight             = 0.1m;
            IO.Swagger.Model.Cylinder cylinder = new IO.Swagger.Model.Cylinder(name, cylinderHeight, cylinderRadius);
            objectModel.Cylinder = cylinder;
            break;

        default:
            throw new NotImplementedException();
        }
        objectModel.Type = modelType;
        objectTypeMeta   = new IO.Swagger.Model.ObjectTypeMeta(builtIn: false, description: "", type: name, objectModel: objectModel,
                                                               _base: "CollisionObject", hasPose: true, modified: DateTime.Now);


        return(objectTypeMeta);
    }
Esempio n. 8
0
    void ICollisionHandler.CollidedWith(CollisionObjectType objectType)
    {
        if (spriteRenderer.isVisible)
        {
            var noSoundAfterLength = 30f;
            var volume             = (noSoundAfterLength - Mathf.Clamp(transform.position.magnitude, 0f, noSoundAfterLength)) / noSoundAfterLength;
            sfxPlayer.PlayRockCollision(volume);
        }

        this.currentCollider.enabled = false;

        if (objectType == CollisionObjectType.Planet)
        {
            v = new Vector2(0, 0);
        }

        timeTillDead = dyingDuration;
    }
Esempio n. 9
0
File: Planet.cs Progetto: nabuk/LD47
 void ICollisionHandler.CollidedWith(CollisionObjectType objectType)
 {
     // TODO: cooldown ?
 }
Esempio n. 10
0
 // The following methods are used internally by the collision detection to make direct
 // changes to a CollisionObject during collision checks.
 /// <summary>
 /// Copies the data from the specified <see cref="CollisionObject"/> and sets the specified
 /// <see cref="IGeometricObject"/>. (For internal use only.)
 /// </summary>
 /// <param name="collisionObject">The collision object.</param>
 /// <param name="geometricObject">The geometric object.</param>
 internal void SetInternal(CollisionObject collisionObject, IGeometricObject geometricObject)
 {
     Changed = collisionObject.Changed;
       CollisionGroup = collisionObject.CollisionGroup;
       _domain = collisionObject._domain;
       Enabled = collisionObject.Enabled;
       _geometricObject = geometricObject;
       _type = collisionObject._type;
       _shapeType = collisionObject._shapeType;
       _shape = geometricObject.Shape;
       ShapeTypeChanged = collisionObject.ShapeTypeChanged;
 }
Esempio n. 11
0
 /// <summary>
 /// Resets the collision object. (For internal use only.)
 /// </summary>
 internal void ResetInternal()
 {
     Changed = true;
       CollisionGroup = 0;
       _domain = null;
       Enabled = true;
       _geometricObject = null;
       _type = CollisionObjectType.Default;
       _shapeType = ShapeType.Default;
       _shape = null;
       ShapeTypeChanged = true;
 }
Esempio n. 12
0
 void LostLife(CollisionObjectType obj)
 {
     StartCoroutine(LostLifeSlowdownCoroutine());
 }