// Use this for initialization
    void Start()
    {
        if (isAutomated)
        {
            rb = GetComponent <Rigidbody>();
            MoveForward();
            return;
        }

        inputDevice    = GetComponent <PlayerInputDevice>().GetPlayerInputDevice();
        rb             = GetComponent <Rigidbody>();
        rends          = GetComponentsInChildren <MeshRenderer>();
        playerAttack   = GetComponent <PlayerAttack>();
        playerTeamInfo = GetComponent <PlayerTeamInfo>();
        playerStats    = GetComponent <PlayerStats>();
        var obj = GameObject.Find("ScoreTracker");

        if (obj != null)
        {
            scoreTracker = GameObject.Find("ScoreTracker").GetComponent <ScoreTracker> ();
        }

        movementCoroutine = StartCoroutine(MovementCoroutine());
        //StartCoroutine (RecordMurderer ());
    }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
//		print (other.tag);
        if (other.CompareTag("Player"))
        {
            PlayerTeamInfo teamInfo = other.gameObject.GetComponent <PlayerTeamInfo> ();
            int            playerTeamNumber;
            if (teamInfo.GetTeam() == "a")
            {
                playerTeamNumber = 1;
            }
            else
            {
                playerTeamNumber = 2;
            }
            if (playerTeamNumber == teamNumber)
            {
                // give points to team
                // FIXME: add points that the player holds


                //if (other.gameObject.GetComponent<PlayerPointManager> ().GetPlayerPoints() > 0) {
                //	gemsRemaining += other.gameObject.GetComponent<PlayerPointManager> ().GetPlayerPoints();
                //	other.gameObject.GetComponent<PlayerPointManager> ().RemovePlayerPoints ();
                //}

                if (other.gameObject.GetComponent <PlayerInventory>().HasGem())
                {
                    gemsRemaining += 1;
                    other.gameObject.GetComponent <PlayerInventory>().SetGem(false);
                }
            }
            else
            {
                // FIXME: give points to player inventory, i.e., player is at enemy chest
                //if (other.gameObject.GetComponent<PlayerPointManager>().GetPlayerPoints() == 0) {
                //    if (gemsRemaining > 0) {
                //        gemsRemaining -= 1;
                //        other.gameObject.GetComponent<PlayerPointManager>().GivePlayerPoints(pointsPerGrab);
                //    }
                //}

                if (!other.gameObject.GetComponent <PlayerInventory>().HasGem())
                {
                    if (gemsRemaining > 0)
                    {
                        gemsRemaining -= 1;
                        other.gameObject.GetComponent <PlayerInventory>().SetGem(true);
                    }
                }
            }
        }
    }