Exemple #1
0
    // Use this for initialization
    void Start()
    {
        planets         = GameObject.FindGameObjectsWithTag("Planet");
        numberOfPlanets = planets.Length;

        _sun = GameObject.FindGameObjectWithTag("Sun").GetComponent <RotationPlanet>();

        numberOfPlanetsVisited = 0;
        myCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraController>();
    }
Exemple #2
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Planet")
        {
            RotationPlanet planetCollide = other.transform.GetComponent <RotationPlanet>();
            GameObject     planet        = other.transform.gameObject;
            Transform      land          = planetCollide.GetLandSpace();

            planetCollide.GetHierva().SetActive(true);


            _imputManager.Shoot = false;
            //transform.position = Vector3.zero;
            // Copy the position &rotation of the landSpace
            transform.SetParent(planetCollide.transform);
            transform.position = planet.transform.position;             // land.position;
            //transform.localRotation = land.rotation;

            _imputManager.canTouch = true;

            //move = false;
            // isOnAPlanet = true;
            // lifeTimeCountDown = lifeTimeOnPlanet;

            // If is the first time we land on thisplanet, add to the planet visited count
            if (!planetCollide.PlanetWasVisited)
            {
                planetCollide.PlanetWasVisited = true;
                _levelManager.PlanetVisited();
            }

            other.tag = "ActivePlanet";
        }
        else if (other.tag == "Asteroid")
        {
            //move = false;
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
        else if (other.tag == "Sun")
        {
            //GameManager.INSTANCE.GameLevel = GameManager.INSTANCE.GameLevel+1;
            Debug.Log("<color=green> GANASTE!!!!! </color>");
            _imputManager.Shoot = false;
            transform.SetParent(other.gameObject.transform);
            transform.position = other.transform.position;
            other.gameObject.transform.parent.transform.GetChild(1).GetChild(0).GetComponent <Animator>().SetTrigger("Finish");
            _levelManager.FinishLevel();
        }
    }