Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     PlayerController[] pController = FindObjectsOfType <PlayerController>();
     for (int i = 0; i < pController.Length; i++)
     {
         Debug.Log(i);
         pControllers[i] = new PConnections(pController[i], new List <GameObject>());
     }
 }
Ejemplo n.º 2
0
    public void Connect(PlayerController pController, GameObject connectedBody)
    {
        PConnections updatedConnection = null;

        updatedConnection = pControllers[FindPConIndex(pController)];
        updatedConnection.connectedObjects.Add(connectedBody);
        if (connectedBody.CompareTag("Player"))
        {
            pControllers[FindPConIndex(connectedBody.transform.parent.GetComponent <PlayerController>())].connectedObjects.Add(pController.leftHinge.gameObject);
        }
        if (updatedConnection != null)
        {
            CheckWalls();
        }
    }
Ejemplo n.º 3
0
    bool CheckConnectedToWall(PConnections pCon)
    {
        bool wall = false;

        foreach (GameObject go in pCon.connectedObjects)
        {
            if (!go.CompareTag("Player"))
            {
                pCon.connectedToWall = true;
                wall = true;
                return(wall);
            }
        }
        pCon.connectedToWall = false;
        return(wall);
    }
Ejemplo n.º 4
0
 void CheckIfOthersConnectedToWall(PConnections pCon)
 {
     //Debug.Log(pCon.connectedToWall);
     if (pCon.connectedToWall == false)
     {
         foreach (GameObject go in pCon.connectedObjects)
         {
             //Debug.Log("not player: " + go.name);
             if (go.CompareTag("Player"))
             {
                 //Debug.Log("Is player: " + go.transform.parent.name);
                 if (pControllers[FindPConIndex(go.transform.parent.GetComponent <PlayerController>())].connectedToWall)
                 {
                     //Debug.Log(go.transform.parent.name);
                     pCon.connectedToWall = true;
                 }
             }
         }
     }
     //Debug.Log(pCon.connectedToWall);
 }