void GetGroundType()
    {
        RaycastHit2D groundhit = Physics2D.Raycast(transform.position, -Vector3.up, GroundCheckRayLength, layerMask);

        if (groundhit)
        {
            string layerName = LayerMask.LayerToName(groundhit.transform.gameObject.layer);

            if (layerName == "OneWayPlatform")
            {
                _groundType = groundType.OneWayPlatform;
                if (!_tempOneWayPlatform)
                {
                    _tempOneWayPlatform = groundhit.transform.gameObject;
                }
            }
            else if (layerName == "LevelGeometry")
            {
                _groundType = groundType.LevelGeometry;
            }
            else
            {
                _groundType = groundType.None;
            }
        }
        else
        {
            //print("NOT HIT");
            _groundType = groundType.None;
        }
    }
Exemple #2
0
 public GroundModel(Model m, int xPos, int yPos, groundType type, Game1 game)
     : base(m, game)
 {
     position   = new Vector3(xPos * 117.3f, yPos * 88.7f, 0);
     scaleValue = 30.0f;
     rotationX  = 0;
     rotationY  = MathHelper.ToRadians(-90.0f);
     rotationZ  = MathHelper.ToRadians(-90.0f);
     this.type  = type;
 }