Exemple #1
0
 void updateTurnVisuals()
 {
     //Gets percentage of completion
     current_percent = ((float)Turns_Elapsed / (float)Turns_Total);
     prev_percent    = ((float)(Turns_Elapsed - 1) / (float)Turns_Total);
     spider_Script.updateTurnVisuals(current_percent);
     elapsedTurnsBar_Script.updateTurnVisuals(current_percent, prev_percent);
     emitter.setParameter("Intensity", ((current_percent * 4.0f) + 1.0f));
 }
    void Update()
    {
        throw_t += Time.deltaTime * deltaTimeMultiplier;

        Vector3 updated_pos;

        updated_pos.x      = start_pos.x + (spider_pos.x - start_pos.x) * throw_t;
        updated_pos.y      = start_pos.y + yvel * throw_t + (0.5f * gravity * throw_t * throw_t);
        transform.position = new Vector3(updated_pos.x, updated_pos.y, start_pos.z);

        if (throw_t >= 1.0f)
        {
            int damage = Random.Range(1, 5);
            spidercontrols.applyDamage(damage);
            Instantiate(animatedCloud);
            string elemental = "";
            if (colour_name == "red")
            {
                elemental = "Fire";
            }
            else if (colour_name == "yellow")
            {
                elemental = "Electricity";
            }
            else if (colour_name == "green")
            {
                elemental = "Grass";
            }
            else if (colour_name == "blue")
            {
                elemental = "Ice";
            }
            emitter.setParameter(elemental, 1.0f);
            emitter.playSound();
            Destroy(gameObject);
        }
    }