Esempio n. 1
0
    public void SpawnRobot()
    {
        if (currentRobot != null)
        {
            return;
        }
        futonHinge.useSpring = false;
        GameObject ob = Instantiate(robotPrefabs[Random.Range(0, robotPrefabs.Length)], spawnPoint.position, spawnPoint.rotation);

        currentRobot             = ob.GetComponent <Robot>();
        currentRobot.thisManager = this;

        Rigidbody r = ob.GetComponent <Rigidbody>();

        if (r == null)
        {
            r = ob.AddComponent <Rigidbody>();
        }

        r.constraints = RigidbodyConstraints.FreezeAll & ~RigidbodyConstraints.FreezePositionY;


        Invoke("CameraIn", 1f);
        Invoke("playSFX", 0.85f);
        currentRobot.Invoke("openHatch", 1.5f);

        claw.SetColliderActive(true);
    }