Ejemplo n.º 1
0
    private void Start()
    {
        myRigidBody2d    = this.gameObject.GetComponent <Rigidbody2D>();
        carrier          = null;
        isInteractable   = true;
        originalPosition = this.gameObject.transform.position;
        originalWorld    = currentWorld;

        EventManager.instance.blockOutOfBounds.AddListener(ResetBlock);
    }
Ejemplo n.º 2
0
 public void MoveToWorld(DataTypes.World world, Transform go)
 {
     if (world == DataTypes.World.WorldOne)
     {
         go.parent = worldOneRoot;
     }
     else
     {
         go.parent = worldTwoRoot;
     }
 }
Ejemplo n.º 3
0
 private void ResetBlock(GameObject blockOOB)
 {
     if (blockOOB == this.gameObject)
     {
         carrier                   = null;
         isInteractable            = true;
         transform.position        = originalPosition;
         myRigidBody2d.isKinematic = false;
         currentWorld              = originalWorld;
         WorldManager.instance.MoveToWorld(currentWorld, transform);
     }
 }
Ejemplo n.º 4
0
 public Vector3 GetPlayerLocation(DataTypes.World world)
 {
     if (world == DataTypes.World.WorldOne)
     {
         Debug.Log("Looking at player: " + myPlayerOneInfo.playerNumber + " at position: " + myPlayerOneInfo.transform.position);
         return(myPlayerOneInfo.transform.position);
     }
     else
     {
         Debug.Log("Looking at player: " + myPlayerTwoInfo.playerNumber + " at position: " + myPlayerTwoInfo.transform.position);
         return(myPlayerTwoInfo.transform.position);
     }
 }
Ejemplo n.º 5
0
    public bool Teleport(DataTypes.World newWorld, float newWorldY)
    {
        if (isInteractable)
        {
            currentWorld       = newWorld;
            transform.position = new Vector3(transform.position.x, newWorldY, transform.position.z);
            WorldManager.instance.MoveToWorld(newWorld, transform);

            return(true);
        }

        return(false);
    }