//这个是旧版离线代码 void RespawnZombie() { if (ZombieCurrentAmount <= respawnerSetting.MaxZombieAmount) { //随机一个僵尸 GameObject newZombie = Instantiate <GameObject>(respawnerSetting.zombiePrefebs[Zoffest % respawnerSetting.zombiePrefebs.Length], respawnerSetting.respawnPlace.position, respawnerSetting.respawnPlace.rotation, transform); ZombieAI zAI = newZombie.GetComponent <ZombieAI>(); for (int i = 0; i < zAI.patrolSettings.waypoints.Length; i++) { zAI.patrolSettings.waypoints[i] = respawnerSetting.waypoints[(i + Zoffest) % respawnerSetting.waypoints.Length]; } ZombieStats zState = newZombie.GetComponent <ZombieStats>(); zState.thisRespwaner = this; ZombieCurrentAmount++; lastRespawnTime = Time.time; Zoffest++; if (Zoffest >= 6) { Zoffest = 0; } } }
WhoInfo FromOffline(PlayerData data, string message) { Group group = Group.findPlayerGroup(data.Name); string color = data.Color == "" ? group.color : data.Color; string prefix = data.Title == "" ? "" : color + "[" + data.TitleColor + data.Title + color + "] "; WhoInfo info = new WhoInfo(); info.FullName = prefix + color + data.Name.TrimEnd('+'); info.Name = data.Name; info.Group = group; info.Money = data.Money; info.Deaths = data.Deaths; info.TotalBlocks = data.TotalModified; info.TotalDrawn = data.TotalDrawn; info.TotalPlaced = data.TotalPlaced; info.TotalDeleted = data.TotalDeleted; info.LoginBlocks = -1; info.TimeSpent = data.TotalTime.ParseDBTime(); info.First = data.FirstLogin; info.Last = data.LastLogin; info.Logins = data.Logins; info.Kicks = data.Kicks; info.IP = data.IP; if (Server.zombie.Running) { ZombieStats stats = Server.zombie.LoadZombieStats(data.Name); info.RoundsTotal = stats.TotalRounds; info.InfectedTotal = stats.TotalInfected; info.RoundsMax = stats.MaxRounds; info.InfectedMax = stats.MaxInfected; } return(info); }
void Start() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); player = FindObjectOfType <PlayerMovement>(); stats = GetComponent <ZombieStats>(); agent = GetComponent <NavMeshAgent>(); agent.updateRotation = false; agent.updateUpAxis = false; agent.speed = speedOnEditor; // ALways starts on roaming mode roaming = true; chasing = false; attacking = false; roamingCurrentAnchorPoint = transform.position; agentEndPosition = roamingCurrentAnchorPoint; reachedEndPosition = false; startCountingDownReachEndPosition = false; checkFinalPosDistance = true; timePassedSincePathStarted = 0; agentEndPosition = transform.position + new Vector3(-0.1f, -0.1f, 0); // fixes initial position bug }
public Stats(string type) { switch (type) { case "zombie": this.constructor(ZombieStats.toString()); this.prefab = zombiePrefab; break; case "flubber": this.constructor(FlubberStats.toString()); this.prefab = flubberPrefab; break; case "spider": this.constructor(SpiderStats.toString()); this.prefab = spiderPrefab; break; case "ghost": this.constructor(GhostStats.toString()); this.prefab = ghostPrefab; break; } }
public void UnstartleAllZombie() { foreach (GameObject zombie in triggeredZombie) { ZombieStats stats = zombie.GetComponent <ZombieStats>(); stats.Unstartle(); } }
//弹孔实现 void HitEffect(RaycastHit hit) { #region Ragdoll //伤害判断 if (hit.collider.gameObject.tag == "Ragdoll") { ZombieStats ZombieHP = hit.collider.gameObject.GetComponentInParent <ZombieStats>(); //伤害判定本地计算 if (owner.gameObject.GetComponent <PhotonView>().isMine) { ZombieHP.ApplyDamage(weaponSettings.damage); } //hitsound //hit forece 有点问题 //bloodSplat if (weaponSettings.bloodSplat) { Vector3 hitPoint = hit.point; Quaternion lookRotation = Quaternion.LookRotation(hit.normal); GameObject bloodSplat = Instantiate(weaponSettings.bloodSplat, hitPoint, lookRotation) as GameObject; Transform bloodSplatT = bloodSplat.transform; Transform hitT = hit.transform; bloodSplatT.SetParent(hitT); Destroy(bloodSplat, 1.0f); } } //简单的玩家判断 if (hit.collider.gameObject.tag == "Player") { CharacterStats otherPlayerState = hit.collider.gameObject.GetComponent <CharacterStats>(); { otherPlayerState.ApplyDamage(weaponSettings.damage); } } #endregion #region decal //墙体标记tag, if (hit.collider.gameObject.tag == "StaticObj") { if (weaponSettings.decal) { Vector3 hitPoint = hit.point; Quaternion lookRotaion = Quaternion.LookRotation(hit.normal); GameObject decal = Instantiate(weaponSettings.decal, hitPoint, lookRotaion) as GameObject; Transform decalT = decal.transform; Transform hitT = hit.transform; decalT.SetParent(hitT); Destroy(decal, Random.Range(30.0f, 45.0f)); } } #endregion }
public override void Use(Player p, string message) { if (message == "") { Help(p); return; } int matches; Player pl = PlayerInfo.FindOrShowMatches(p, message, out matches); if (matches > 1) { return; } if (matches == 1) { Player.SendMessage(p, pl.color + pl.name + " %Sis online, using /whois instead."); Command.all.Find("whois").Use(p, message); return; } if (!Player.ValidName(message)) { Player.SendMessage(p, "\"" + message + "\" is not a valid player name."); return; } OfflinePlayer target = PlayerInfo.FindOffline(message, true); if (target == null) { Player.SendMessage(p, "\"" + message + "\" was not found in the database."); Player.SendMessage(p, "Note you must use a player's full account name."); return; } Group group = Group.Find(Group.findPlayer(message)); string color = target.color == "" ? group.color : target.color; string prefix = target.title == "" ? "" : "[" + target.titleColor + target.title + color + "] "; WhoInfo info = new WhoInfo(); info.FullName = prefix + color + target.name.TrimEnd('+'); info.Name = target.name; info.Group = group; info.Money = int.Parse(target.money); info.Deaths = int.Parse(target.deaths); info.TotalBlocks = long.Parse(target.blocks); info.LoginBlocks = -1; info.TimeSpent = target.totalTime.ParseDBTime(); info.First = DateTime.Parse(target.firstLogin); info.Last = DateTime.Parse(target.lastLogin); info.Logins = int.Parse(target.logins); info.Kicks = int.Parse(target.kicks); info.IP = target.ip; if (Server.zombie.Running) { ZombieStats stats = Server.zombie.LoadZombieStats(target.name); info.RoundsTotal = stats.TotalRounds; info.InfectedTotal = stats.TotalInfected; info.RoundsMax = stats.MaxRounds; info.InfectedMax = stats.MaxInfected; } WhoInfo.Output(p, info, CheckAdditionalPerm(p)); }
private static void readXML() { TextAsset temporal = (TextAsset)Resources.Load("data/enemyData"); xmlAsset.LoadXml(temporal.text); ZombieStats.read(xmlAsset.ChildNodes[1]["zombie"]); FlubberStats.read(xmlAsset.ChildNodes[1]["flubber"]); SpiderStats.read(xmlAsset.ChildNodes[1]["spider"]); GhostStats.read(xmlAsset.ChildNodes[1]["ghost"]); }
public void SetZombieType(ZombieType type) { // go query the zombie type manager for our stats stats = ZombieManager.GetStatsForType((int)type); zombieType = type; // query the zombie manager for the material this.GetComponent <MeshRenderer> ().sharedMaterial = ZombieManager.GetMaterialForType((int)type); // get the scale too thisTransform.localScale = ZombieManager.GetScaleForType((int)type); // set the nucleus multiplier speed nucleus.multiplier = stats.speed; }
private void OnCollisionEnter2D(Collision2D other) { master.PlaySound("Hit"); if (other.gameObject.CompareTag("Zombie")) { ZombieStats zombie = other.gameObject.GetComponent <ZombieStats>(); zombie.TakeDamage(bulletDamage); if (!zombie.IsStartled()) { zombie.Startle(); } } else if (other.gameObject.CompareTag("Crate")) { Crate crate = other.gameObject.GetComponent <Crate>(); crate.Break(2); } Instantiate(hitParticle, transform.position, Quaternion.identity); Destroy(gameObject); }
void SetNewZombie(int viewID) { // //Debug.Log("RPC SetNewZombie() called"); PhotonView zombiephotonView = PhotonView.Find(viewID); if (zombiephotonView == null) { Debug.Log("Can not find PhotonView with ID viewID , in SetNewZombie()"); return; } ZombieAI zAI = zombiephotonView.gameObject.GetComponent <ZombieAI>(); ZombieStats zState = zombiephotonView.gameObject.GetComponent <ZombieStats>(); for (int i = 0; i < zAI.patrolSettings.waypoints.Length; i++) { zAI.patrolSettings.waypoints[i] = respawnerSetting.waypoints[(i + Zoffest) % respawnerSetting.waypoints.Length]; } zState.thisRespwaner = this; }
WhoInfo FromOffline(PlayerData data, string message) { Group group = Group.GroupIn(data.Name); string color = data.Color == "" ? group.Color : data.Color; string prefix = data.Title == "" ? "" : color + "[" + data.TitleColor + data.Title + color + "] "; WhoInfo info = new WhoInfo(); info.FullName = prefix + color + data.Name.TrimEnd('+'); info.Name = data.Name; info.Group = group; info.Money = data.Money; info.Deaths = data.Deaths; info.TotalBlocks = data.TotalModified; info.TotalDrawn = data.TotalDrawn; info.TotalPlaced = data.TotalPlaced; info.TotalDeleted = data.TotalDeleted; info.LoginBlocks = -1; info.TimeSpent = data.TotalTime.ToString().ParseDBTime(); info.First = data.FirstLogin; info.Last = data.LastLogin; info.Logins = data.Logins; info.Kicks = data.Kicks; info.IP = data.IP; if (Server.zombie.Running) { ZombieStats stats = Server.zombie.LoadZombieStats(data.Name); info.RoundsTotal = stats.TotalRounds; info.InfectedTotal = stats.TotalInfected; info.RoundsMax = stats.MaxRounds; info.InfectedMax = stats.MaxInfected; } if (Core.Match != null) { FootballStats stats = Stats.LoadFootballStats(data.Name); info.TotalRounds = stats.TotalRounds; info.Wins = stats.Wins; info.Losses = stats.Losses; info.Draws = stats.Draws; info.Goals = stats.Goals; info.Assists = stats.Assists; info.OwnGoals = stats.OwnGoals; info.Saves = stats.Saves; } return(info); }
void Attack() { if (Input.GetMouseButtonDown(0)) { if (isAttacking) { return; } Vector3 effOffset = new Vector2(player.facing == "L" ? -1 : 1, 0); GameObject eff = Instantiate(slashEffect, transform.position + effOffset, Quaternion.identity); eff.transform.localScale = new Vector2(player.facing == "L" ? -2 : 2, 2); Destroy(eff, 0.3f); knifeAnim.SetBool("isMeleeAttacking", true); Invoke("SetNotAttacking", 0.2f); isAttacking = true; Collider2D[] colliders = Physics2D.OverlapBoxAll(transform.position + (Vector3)(hitboxOffset * hitboxFacing), hitboxSize, 0f); foreach (Collider2D collider in colliders) { if (collider.gameObject.CompareTag("Zombie")) { ZombieStats zombie = collider.GetComponent <ZombieStats>(); zombie.TakeDamage(4); zombie.AddKnockback(transform.position, 100); } else if (collider.gameObject.CompareTag("Crate")) { Crate crate = collider.gameObject.GetComponent <Crate>(); crate.Break(4); } } } }
void CompleteLoginProcess() { LevelPermission adminChatRank = CommandOtherPerms.FindPerm("adminchat", LevelPermission.Admin); SendUserMOTD(); SendMap(null); if (disconnected) { return; } loggedIn = true; PlayerInfo.Online.Add(this); connections.Remove(this); RemoveFromPending(); Server.s.PlayerListUpdate(); //OpenClassic Client Check SendBlockchange(0, 0, 0, 0); timeLogged = DateTime.Now; lastLogin = DateTime.Now; time = new TimeSpan(0, 0, 0, 1); DataTable playerDb = Database.Backend.GetRows("Players", "*", "WHERE Name=@0", name); if (playerDb.Rows.Count == 0) { InitPlayerStats(playerDb); } else { LoadPlayerStats(playerDb); } Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); CheckState(); ZombieStats stats = Server.zombie.LoadZombieStats(name); Game.MaxInfected = stats.MaxInfected; Game.TotalInfected = stats.TotalInfected; Game.MaxRoundsSurvived = stats.MaxRounds; Game.TotalRoundsSurvived = stats.TotalRounds; if (!Directory.Exists("players")) { Directory.CreateDirectory("players"); } PlayerDB.Load(this); Game.Team = Team.FindTeam(this); SetPrefix(); playerDb.Dispose(); LoadCpeData(); if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) { adminpen = true; } if (Server.noEmotes.Contains(name)) { parseEmotes = !Server.parseSmiley; } hidden = group.CanExecute("hide") && Server.hidden.Contains(name); if (hidden) { SendMessage("&8Reminder: You are still hidden."); } if (group.Permission >= adminChatRank && Server.adminsjoinsilent) { hidden = true; adminchat = true; } if (PlayerConnect != null) { PlayerConnect(this); } OnPlayerConnectEvent.Call(this); if (cancellogin) { cancellogin = false; return; } string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this); if (hidden) { joinm = "&8(hidden)" + joinm; } const LevelPermission perm = LevelPermission.Guest; if (group.Permission > perm || (Server.guestJoinNotify && group.Permission <= perm)) { Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { if (Entities.CanSee(pl, this)) { Player.Message(pl, joinm); } } } if (Server.agreetorulesonentry && group.Permission == LevelPermission.Guest && !Server.agreed.Contains(name)) { SendMessage("&9You must read the &c/rules&9 and &c/agree&9 to them before you can build and use commands!"); agreed = false; } if (Server.verifyadmins && group.Permission >= Server.verifyadminsrank) { if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + name + ".dat")) { SendMessage("&cPlease set your admin verification password with &a/setpass [Password]!"); } else { SendMessage("&cPlease complete admin verification with &a/pass [Password]!"); } } Server.s.Log(name + " [" + ip + "] has joined the server."); Game.InfectMessages = PlayerDB.GetInfectMessages(this); Server.zombie.PlayerJoinedServer(this); ushort x = (ushort)(level.spawnx * 32 + 16); ushort y = (ushort)(level.spawny * 32 + 32); ushort z = (ushort)(level.spawnz * 32 + 16); pos = new ushort[3] { x, y, z }; rot = new byte[2] { level.rotx, level.roty }; Entities.SpawnEntities(this, x, y, z, rot[0], rot[1]); PlayerActions.CheckGamesJoin(this, null); Loading = false; }
public ZombieAI(Unit unit, NavMeshAgent navAgent, ZombieStats stats) : base(unit, navAgent, stats) { state = new TargetSearchState(this); }
void CompleteLoginProcess() { // Lock to ensure that no two players can end up with the same playerid lock (PlayerInfo.Online.locker) { id = NextFreeId(); PlayerInfo.Online.Add(this); } SendMap(null); if (disconnected) { return; } loggedIn = true; connections.Remove(this); RemoveFromPending(); Server.PlayerListUpdate(); SessionStartTime = DateTime.UtcNow; LastLogin = DateTime.Now; TotalTime = TimeSpan.FromSeconds(1); GetPlayerStats(); ShowWelcome(); Server.Background.QueueOnce(ShowAltsTask, name, TimeSpan.Zero); CheckState(); ZombieStats stats = Server.zombie.LoadZombieStats(name); Game.MaxInfected = stats.MaxInfected; Game.TotalInfected = stats.TotalInfected; Game.MaxRoundsSurvived = stats.MaxRounds; Game.TotalRoundsSurvived = stats.TotalRounds; if (!Directory.Exists("players")) { Directory.CreateDirectory("players"); } PlayerDB.Load(this); Game.Team = Team.TeamIn(this); SetPrefix(); LoadCpeData(); if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) { adminpen = true; } if (Server.noEmotes.Contains(name)) { parseEmotes = !ServerConfig.ParseEmotes; } LevelPermission adminChatRank = CommandExtraPerms.MinPerm("adminchat", LevelPermission.Admin); hidden = group.CanExecute("hide") && Server.hidden.Contains(name); if (hidden) { SendMessage("&8Reminder: You are still hidden."); } if (group.Permission >= adminChatRank && ServerConfig.AdminsJoinSilently) { hidden = true; adminchat = true; } OnPlayerConnectEvent.Call(this); if (cancellogin) { cancellogin = false; return; } string joinm = "&a+ " + FullName + " %S" + PlayerDB.GetLoginMessage(this); if (hidden) { joinm = "&8(hidden)" + joinm; } const LevelPermission perm = LevelPermission.Guest; if (group.Permission > perm || (ServerConfig.GuestJoinsNotify && group.Permission <= perm)) { Chat.MessageGlobal(this, joinm, false, true); } if (ServerConfig.AgreeToRulesOnEntry && group.Permission == LevelPermission.Guest && !Server.agreed.Contains(name)) { SendMessage("&9You must read the &c/Rules&9 and &c/Agree&9 to them before you can build and use commands!"); agreed = false; } if (ServerConfig.verifyadmins && group.Permission >= ServerConfig.VerifyAdminsRank) { if (!Directory.Exists("extra/passwords") || !File.Exists("extra/passwords/" + name + ".dat")) { SendMessage("&cPlease set your admin verification password with %T/SetPass [Password]!"); } else { SendMessage("&cPlease complete admin verification with %T/Pass [Password]!"); } } try { if (group.CanExecute("inbox") && Database.TableExists("Inbox" + name)) { using (DataTable table = Database.Backend.GetRows("Inbox" + name, "*")) { if (table.Rows.Count > 0) { SendMessage("You have &a" + table.Rows.Count + " %Smessages in %T/Inbox"); } } } } catch { } if (ServerConfig.PositionUpdateInterval > 1000) { SendMessage("Lowlag mode is currently &aON."); } if (String.IsNullOrEmpty(appName)) { Logger.Log(LogType.UserActivity, "{0} [{1}] connected.", name, ip); } else { Logger.Log(LogType.UserActivity, "{0} [{1}] connected using {2}.", name, ip, appName); } Game.InfectMessages = PlayerDB.GetInfectMessages(this); Server.lava.PlayerJoinedServer(this); Position pos = level.SpawnPos; byte yaw = level.rotx, pitch = level.roty; OnPlayerSpawningEvent.Call(this, ref pos, ref yaw, ref pitch, false); Pos = pos; SetYawPitch(yaw, pitch); Entities.SpawnEntities(this, true); PlayerActions.CheckGamesJoin(this, null); Loading = false; }
void Start() { zombieStats = GetComponent <ZombieStats>(); zombieHealth = GetComponent <HealthScript>(); }