Exemplo n.º 1
0
    private void initializeVariables()
    {
        kameEffect.transform.rotation = Quaternion.LookRotation(GameManager.player.transform.forward, GameManager.player.transform.up);
        GameObject[] planets          = GravityAttractorsManager.getGravityAttractors();
        float        smallestDistance = float.PositiveInfinity;

        foreach (GameObject planet in planets)
        {
            if (Vector3.Distance(planet.transform.position, GameManager.player.transform.position) < smallestDistance)
            {
                closestPlanetCenter = planet.transform.position;
                smallestDistance    = Vector3.Distance(planet.transform.position, GameManager.player.transform.position);
            }
        }
        isFinished = false;
        //kameEffect.SetActive (true);
        kameEffect.SetActive(false);
        kameCore.SetActive(true);
        kameCore.GetComponent <ParticleSystem>().Play();
        startPosition = ((GameManager.player.GetComponent <Rigidbody> ().worldCenterOfMass + (GameManager.player.transform.up * 0.15f))) + (kameEffect.transform.forward * 0.4f);
        kameEffect.transform.position = startPosition;
        kameCore.transform.position   = startPosition;
        kameCore.transform.forward    = kameEffect.transform.forward;
        timer           = 0f;
        objectsCollided = 0;

        isCharged = false;
    }
Exemplo n.º 2
0
    //2. Initializes the kame and shows the direction line (Called when the animation starts)
    private void animationStarted()
    {
        chargeTimer = 0f;
        kameEffect.transform.rotation = Quaternion.LookRotation(GameManager.player.transform.forward, GameManager.player.transform.up);
        //Find closest planet
        GameObject[] planets          = GravityAttractorsManager.getGravityAttractors();
        float        smallestDistance = float.PositiveInfinity;

        foreach (GameObject planet in planets)
        {
            if (Vector3.Distance(planet.transform.position, GameManager.player.transform.position) < smallestDistance)
            {
                closestPlanet    = planet;
                smallestDistance = Vector3.Distance(planet.transform.position, GameManager.player.transform.position);
            }
        }
        //Initialize elements
        hasHitGround = false;
        isFinished   = false;
        kameEffect.SetActive(false);
        kameCore.SetActive(true);
        kameCore.GetComponent <ParticleSystem>().Play();
        startPosition = ((GameManager.player.GetComponent <Rigidbody> ().worldCenterOfMass + (GameManager.player.transform.up * 0.15f))) + (kameEffect.transform.forward * 0.4f);
        kameEffect.transform.position = startPosition;
        kameCore.transform.position   = startPosition;
        kameCore.transform.forward    = kameEffect.transform.forward;
        objectsCollided  = 0;
        enemiesHit       = new List <GameObject> (0);
        transform.parent = closestPlanet.transform;
        if (!elementAttack.Equals(ElementType.None))
        {
            elementalParticleOnCharge.SetActive(true);
            elementalParticleOnCharge.GetComponent <ParticleSystem>().Play();
            Material material = AttackElementsManager.getElement(elementAttack).material;
            if (material != null)
            {
                elementalParticleSystem.GetComponent <ParticleSystemRenderer>().material   = material;
                elementalParticleOnCharge.GetComponent <ParticleSystemRenderer>().material = material;
            }
        }
        //Starts to update the charging up of the kame
        isCharged  = false;
        isCharging = true;
        Util.changeTime(slowTimeProportion);
        isFinished     = false;
        arrowDirection = GameManager.player.transform.forward;
        directionalLine.SetActive(true);
        directionalLine.GetComponent <LineRenderer> ().SetPosition(0, GameManager.player.GetComponent <Rigidbody>().worldCenterOfMass);
        directionalLine.GetComponent <LineRenderer> ().SetPosition(1, GameManager.player.GetComponent <Rigidbody>().worldCenterOfMass + (lineLength * arrowDirection.normalized));
        StartCoroutine(updateCharge());
    }
Exemplo n.º 3
0
    void Start()
    {
        disappearing = false;
        originalPos  = transform.position;
        GameObject[] planets = GravityAttractorsManager.getGravityAttractors();
        closestPlanetCenter = new Vector3(0f, 0f, 0f);
        float smallestDistance = float.PositiveInfinity;

        foreach (GameObject planet in planets)
        {
            float distance = Vector3.Distance(planet.transform.position, transform.position);
            if (distance < smallestDistance)
            {
                closestPlanetCenter = planet.transform.position;
                smallestDistance    = distance;
            }
        }
        timer = Random.value;
    }
Exemplo n.º 4
0
 void Start()
 {
     planets = GravityAttractorsManager.getGravityAttractors();
     GetComponent <Rigidbody> ().drag = drag;
     onStart();
 }