// COLLISIONS---------------------------------------------------------------------------------------------------------------------------------------------
    private void OnTriggerEnter2D(Collider2D other)
    {
        // Sees if player collided with something that will kill you
        if (other.CompareTag("Traps") || other.CompareTag("Enemy"))
        {
            GameEvents.current.PlayerDeath();
        }

        // Sees if the player collided with fuel
        if (other.CompareTag("Fuel"))
        {
            FuelScript pickup = other.GetComponent <FuelScript>();
            if (pickup == null)
            {
                Debug.LogError("FuelScript Not found");
            }
            else
            {
                Refuel(pickup.fuelAmount, pickup.maxIncrease);
            }
        }

        if (other.CompareTag("ChemicalFuel"))
        {
            ChemicalFuelScript pickup = other.GetComponent <ChemicalFuelScript>();
            if (pickup == null)
            {
                Debug.LogError("FuelScript Not found");
            }
            else
            {
                SwitchBurnMode();
                fuel = maxFuel;
                remainingCombustionTimeTimer = pickup.combustionTime;
            }
        }

        // Sees if the player collided with a checkpoint
        if (other.CompareTag("Checkpoint"))
        {
            CheckPoint newCheckPoint = other.GetComponent <CheckPoint>();
            if (newCheckPoint == null)
            {
                Debug.LogError("Collided with Checkpoint, but Script not found");
            }
            else
            {
                CompairCheckPoints(newCheckPoint);
            }
        }
    }
예제 #2
0
    void Start()
    {
        health = GetComponent <HealthScript> ();
        fuel   = GetComponent <FuelScript> ();
        stats  = GetComponent <PlayerStats> ();

        rb    = GetComponent <Rigidbody> ();
        input = GetComponent <TeamAssignment> ();


        if (input.myTeam == TeamAssignment.Team.TEAM_A)
        {
            playerNum = 1;
        }
        else
        {
            playerNum = 2;
        }
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        stats        = GetComponent <PlayerStats> ();
        health       = GetComponent <HealthScript> ();
        fuel         = GetComponent <FuelScript> ();
        currentSpeed = defaultSpeed;
        input        = GetComponent <TeamAssignment> ();
//		rb = GetComponent<Rigidbody> ();

        ray = new Ray(transform.position, transform.forward);



        if (input.myTeam == TeamAssignment.Team.TEAM_A)
        {
            playerNum = 1;
        }
        else
        {
            playerNum = 2;
        }
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        health = GetComponent <HealthScript> ();
        fuel   = GetComponent <FuelScript> ();
        rb     = GetComponent <Rigidbody> ();
        input  = GetComponent <TeamAssignment> ();
        stats  = GetComponent <PlayerStats> ();

        bullet = null;

        if (input.myTeam == TeamAssignment.Team.TEAM_A)
        {
            playerNum = 1;
        }
        else
        {
            playerNum = 2;
        }

        mainCollider = GetComponent <BoxCollider> ();

        zone1.gameObject.SetActive(false);
        zone2.gameObject.SetActive(false);
    }