Пример #1
0
 public void Detach()
 {
     if (!below)
     {
         return;
     }
     if (belowPlayer)
     {
         belowPlayer.above = null;
         belowPlayer       = null;
     }
     if (robot)
     {
         // Robot move
         robot.MovementController.Horizontal      = 0;
         robot.MovementController.Vertical        = 0;
         robot.MovementController.RightHorizontal = 0;
         robot.MovementController.RightVertical   = 0;
         // Robot attack
         robot.AttackController.Attack = false;
         robot        = null;
         head.enabled = true;
     }
     StartCoroutine(ReactivateCollider(below));
     below             = null;
     rigid.isKinematic = false;
     rigid.velocity    = Vector3.zero;
     transform.parent  = null;
 }
Пример #2
0
 // Landing on stuff
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "ObjectHeadSlot" && !below)
     {
         other.enabled     = false;
         below             = other;
         rigid.isKinematic = true;
         belowPlayer       = other.transform.root.GetComponentInChildren <LandingLogic>();
         if (belowPlayer)
         {
             while (belowPlayer.above)
             {
                 belowPlayer = belowPlayer.above;
             }
             belowPlayer.above = this;
         }
         robot = other.transform.root.GetComponent <Robot>();
         if (robot)
         {
             if (above)
             {
                 above.Detach();
             }
             head.enabled = false;
         }
         transform.parent = other.transform;
     }
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     robot = null;
     above = null;
     below = null;
     rigid = GetComponent <Rigidbody>();
 }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        if (PlayerNumber < 1 || PlayerNumber > 4)
        {
            Debug.LogError("Don't do that again. -- Victor");
        }

        movementController  = GetComponent <MovementController>();
        jumpThrowController = GetComponent <JumpThrowController>();
        attackController    = GetComponent <AttackController>();
        landingLogic        = GetComponent <LandingLogic>();
        rigid = GetComponent <Rigidbody>();
        floor = GetComponentInChildren <FloorCollider>();

        Transform indicatorTransform = transform.Find("Indicator");

        if (indicatorTransform == null)
        {
            Debug.LogError("Please attach an Indicator to the player (both human and robot)!");
        }
        else
        {
            indicator = indicatorTransform.gameObject;
        }

        startPosition = transform.position;
    }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        otherPlayers = new List <GameObject>(3);
        GameObject[] allPlayers = GameObject.FindGameObjectsWithTag("Player");
        foreach (var player in allPlayers)
        {
            if (player == gameObject)
            {
                continue;
            }
            otherPlayers.Add(player);
        }

        landingLogic = GetComponent <LandingLogic>();
    }
 // Use this for initialization
 void Start()
 {
     playerRigidbody = gameObject.GetComponent <Rigidbody>();
     lander          = GetComponent <LandingLogic>();
 }