Ejemplo n.º 1
0
 void Awake()
 {
     if (my_number == 0 || my_number == 1)
     {
         team = HUD.Team.BLUE;
         label.GetComponent <SpriteRenderer>().color = PLAYER_2_COLOR;
     }
     else
     {
         team = HUD.Team.RED;
         label.GetComponent <SpriteRenderer>().color = PLAYER_1_COLOR;
     }
 }
Ejemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        bool stolen = false;

        passing_target = null;
        if (coll.gameObject.tag == "Player" && HUD.S.GameStarted)
        {
            Player coll_player = coll.gameObject.GetComponent <Player>();
            if (transform.parent != null && coll_player.team == ball_team)
            {
                return;
            }
            if (transform.parent != null)
            {
                if (ball_team != HUD.Team.NONE && coll_player.team != ball_team)
                {
                    HUD.S.SuccessfulSteal();
                    Statistics.S.stealStat(coll_player.my_number);
                    stolen = true;
                }
                transform.parent.gameObject.GetComponent <Player>().loseControlOfBall(stolen);
            }

            coll.gameObject.GetComponent <Player>().gainControlOfBall();
            lastPlayerTouched = coll.gameObject.GetComponent <Player>().my_number;
            fade_particles    = false;
            ball_team         = coll_player.team;
            parentrb          = coll.gameObject.GetComponent <Rigidbody2D>();
        }

        if (coll.gameObject.tag == "LevelBounds")
        {
            HUD.S.PlaySound("boing", Random.Range(.5f, 1f));
            hit_wall_cooldown = hit_wall_delay;
            hit_wall          = true;
        }

        if (coll.gameObject.tag == "AsteroidBreakable" && ball_in_play)
        {
            HUD.S.PlaySound("objecthit2", Random.Range(.5f, 1f));
            if (rb.velocity.magnitude > 10f && transform.parent == null)
            {
                coll.gameObject.GetComponent <Asteriod>().Destroy();
            }
            hit_wall_cooldown = hit_wall_delay;
            hit_wall          = true;
        }
        hit_wall_cooldown = hit_wall_delay;
        hit_wall          = true;
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        lerp_start           = 0f;
        original_point_order = new GameObject[lerp_points.Length];
        Array.Copy(lerp_points, original_point_order, lerp_points.Length);
        resetGoal();

        if (team == HUD.Team.RED)
        {
            other_team = HUD.Team.BLUE;
        }
        else
        {
            other_team = HUD.Team.RED;
        }
    }
Ejemplo n.º 4
0
 public void score(HUD.Team team)
 {
     CameraShaker.S.DoShake(0.08f, 0.15f);
     HUD.S.teamScored(team);
 }