示例#1
0
    public void ReportDeath(CharacterBuildScript build)
    {
        if(build.networkView.isMine)		//we only report scores for our own player
        {
            networkView.RPC("AddDeath", RPCMode.Server, build.build.owner);
            //GetPlayerScore(build.build.owner).deaths++;

            Targetable playerHit = build.GetComponent<Targetable>();

            if(!playerHit)
            {
                Debug.LogError("There is no Targetable on this player to report a score for");
                return;
            }

            HitStruct lastHit = new HitStruct(-1f);
            List<HitStruct> hits = playerHit.GetHits(GameSettings.hitAddsToScoreTime);
            foreach(HitStruct hit in hits)
            {
                if(hit.timestamp > lastHit.timestamp)
                    lastHit = hit;
            }

            //apply kill/assist points appropriately to all players that had hit the dead player
            foreach(HitStruct hit in hits)
            {
                if(hit.attacker == lastHit.attacker)
                    networkView.RPC("AddKill", RPCMode.Server, lastHit.attacker.build.owner);
                    //GetPlayerScore(lastHit.attacker.build.owner).kills++;
                else
                    networkView.RPC("AddAssist", RPCMode.Server, hit.attacker.build.owner);
                    //GetPlayerScore(hit.attacker.build.owner).assists++;
            }
        }
    }
示例#2
0
 public void AddToPlayer(CharacterBuildScript player)
 {
     Ability ability = (Ability)player.gameObject.AddComponent(scriptName);
     ability.abilityData = this;
     player.AddAbility(ability);
     ability.AddPlayer(player);
 }
示例#3
0
 HitStruct GetMostRecentHit(CharacterBuildScript player)
 {
     HitStruct mostRecent = new HitStruct(-1);
     foreach(HitStruct hit in hits)
     {
         if(hit.attacker == player && hit.timestamp > mostRecent.timestamp)
             mostRecent = hit;
     }
     return mostRecent;
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     character = GetComponent <CharacterBuildScript>();
     movement = GetComponent<CharacterMoveScript>();
     GameObject game = GameObject.FindGameObjectWithTag("GameController");
     cameraController = game.GetComponent<CameraControllerScript>();
     settings = game.GetComponent<PlayerSettingsScript>();
     ability1IsHeld = false;
     ability2IsHeld = false;
 }
示例#5
0
 void Start()
 {
     character = GetComponent<CharacterBuildScript> ();
 }
示例#6
0
 public void AddPlayer(CharacterBuildScript build)
 {
     player = build;
 }
 public void RegisterPlayerData(PlayerCharacterSettingsScript characterBuild)
 {
     build = characterBuild.character;
 }
示例#8
0
 public void ClearCharacterBuild()
 {
     playerBuild = null;
 }
示例#9
0
 public void RegisterCharacterBuild(CharacterBuildScript build)
 {
     playerBuild = build;
 }
示例#10
0
 public void HitBy(CharacterBuildScript attacker)
 {
     hits.Add(new HitStruct(attacker, build));
 }
示例#11
0
 public HitStruct(CharacterBuildScript atkr, CharacterBuildScript dfnd)
 {
     playerHit = dfnd;
     attacker = atkr;
     timestamp = Time.time;
 }
示例#12
0
 public HitStruct(float ts)
 {
     playerHit = null;
     attacker = null;
     timestamp = ts;
 }
示例#13
0
 void Start()
 {
     build = GetComponent<CharacterBuildScript>();
     build.totalJumps++;
 }