예제 #1
0
    /// <summary>
    /// Finish adding influence, set which team controls it
    /// </summary>
    public void finishInfluence()
    {
        ///TODO: add end semaphore stuff her
        if(controllingTeam != owningTeam){
            if(_percControlled > 100f){
                _percControlled = 100f;
                currentState = TileState.normal;
                if(controllingTeam.teamNumber == 1)	audio.clip = sRef.InfluenceDoneLo;
                if(controllingTeam.teamNumber == 2) audio.clip = sRef.InfluenceDoneHi;

                if (!audio.isPlaying) {
                    audio.volume = sRef.playerInfluenceDoneVolume;
                    audio.Play (); //activate this if we want every tile influenced to trigger a sound, including the ones influenced by beacons
                }

            }
            owningTeam = controllingTeam;
            Beacon localBeacon = GetComponentInChildren<Beacon>();
            Altar localAltar = GetComponentInChildren<Altar>();
            owningTeam.ScoreFromTile (getTileScore ());

            if(localAltar !=null){
                localAltar.setControl(owningTeam);
            }
            if(localBeacon!= null){
                localBeacon.setTeam (owningTeam);
                localBeacon.UpdateInfluencePatterns();
            }

            Reveal (sRef.influenceRevealRange);
            //TODO: possible huge performance hit here
            gm.tileSendMessage("setDistanceToHomeBase");
            //setDistanceToHomeBase();
            PS.startColor = controllingTeam.beaconColor;
            PS.Emit(100);

        }
    }