示例#1
0
    void Awake()
    {
        layermask = LayerMask.GetMask("Obstacles", "Ground", "CameraWall");      //(1 << LayerMask.NameToLayer("Obstacles")) | (1 << LayerMask.NameToLayer("Ground"));


        // Initialize array of collision points
        collisionPoints = new Transform[10];

        collisionPoints[(int)COLLISIONPOINT.GROUNDED1] = transform.Find("groundedCheck1").transform;
        collisionPoints[(int)COLLISIONPOINT.GROUNDED2] = transform.Find("groundedCheck2").transform;
        collisionPoints[(int)COLLISIONPOINT.LEFT]      = transform.Find("left").transform;
        collisionPoints[(int)COLLISIONPOINT.RIGHT]     = transform.Find("right").transform;


        collisionPoints[(int)COLLISIONPOINT.CORNER1] = transform.Find("corner1").transform;
        collisionPoints[(int)COLLISIONPOINT.CORNER2] = transform.Find("corner2").transform;
        collisionPoints[(int)COLLISIONPOINT.CORNER3] = transform.Find("corner3").transform;
        collisionPoints[(int)COLLISIONPOINT.CORNER4] = transform.Find("corner4").transform;

        collisionPoints[(int)COLLISIONPOINT.BIG1] = transform.Find("big1").transform;
        collisionPoints[(int)COLLISIONPOINT.BIG2] = transform.Find("big2").transform;


        hits = new Collider2D[5];

        body = gameObject.GetComponent <SMBPhysicsBody>();

        if (body == null)
        {
            Debug.LogError("Collisions need BasicMovement to work");
        }
    }
示例#2
0
 void Awake()
 {
     body     = gameObject.GetComponent <SMBPhysicsBody>();
     obsColls = gameObject.GetComponent <ObstacleCollision>();
 }