void CastDebuff(Dictionary <SkillType, int> force) // cast player --> casted player { IVPlayer target = _hostserver.GetNearestPlayer(transform.position, Arrow.theta); KeyValuePair <SkillType[], int[]> Sforce = IVSkill.DicToPair(force); CmdCastedBuff(target.GetComponent <NetworkIdentity>().netId, Sforce.Key, Sforce.Value); }
public IVPlayer GetNearestPlayer(Vector3 pos, float theta) { IVPlayer minplayer = null; float min = 190f; theta = Mathf.Deg2Rad * theta; Vector3 dir = new Vector3(Mathf.Cos(theta), 0, Mathf.Sin(theta)); foreach (int num in players.Keys) { IVPlayer player = players[num].gameObject.GetComponent <IVPlayer>(); if (player.transform.position == pos) { continue; } float deg = Vector3.Angle(dir, player.transform.position - pos); if (deg < min) { min = deg; minplayer = player; } } if (minplayer == null) { Debug.Log("There are no nearest player"); } return(minplayer); }
//called when this player kills a monster on Dead() in Monster component public void Loot(NetworkIdentity p, string keyword, SkillType type) { Debug.Log("Looting : ID is " + id); IVPlayer target = p.GetComponent <IVPlayer>(); target.KeywordsInventory.Add(keyword); target.SkillTypeInventory[type] += 1; GameObject.Find("Manager").GetComponent <IVUIManager>().UpdatePlayerKeywordText(id, type, SkillTypeInventory[type]); GameObject.Find("Manager").GetComponent <IVUIManager>().OnClickCastingWindowFilter(id); }
void RpcAttackPlayer(NetworkIdentity id, int index, int dmg) { IVPlayer p = id.gameObject.GetComponent <IVPlayer>(); p.ConfigStatus(0, SkillType.Null, -dmg); Debug.Log("Player" + id + "has attacked player with id " + p.id + "; damage is " + dmg); if (p.HP <= 0) { Debug.Log("Player" + id + "has killed player with id " + p.id); p.Dead(); } }
public void AttackPlayer(NetworkIdentity id, int index, Dictionary <SkillType, int> force) { if (!isServer) { return; } else if (index == this.id) { IVPlayer p = id.gameObject.GetComponent <IVPlayer>(); int dmg = IVSpellManager.DamageCalculator(Calculate(true), p.Calculate(false)); RpcAttackPlayer(id, index, dmg); } }
public bool IsGameEnd(IVPlayer deadPlayer) { _game.Players.Remove(deadPlayer); if (_game.Players.Count == 1) { currentState = State.EndPhase; return(true); } else { return(false); } }
public void InitCastPhase(IVPlayer p) { Color c = Color.white; switch (type) { case SkillType.neutral: c = (Resources.Load("Material/Monster-neutral", typeof(Material)) as Material).color; break; case SkillType.darkness: c = (Resources.Load("Material/Monster-darkness", typeof(Material)) as Material).color; break; case SkillType.evil: c = (Resources.Load("Material/Monster-evil", typeof(Material)) as Material).color; break; case SkillType.holy: c = (Resources.Load("Material/Monster-holy", typeof(Material)) as Material).color; break; case SkillType.lightness: c = (Resources.Load("Material/Monster-lightness", typeof(Material)) as Material).color; break; } GetComponent <Image>().color = c; if (!p.KeywordsInventory.Contains(keyword)) { gameObject.SetActive(false); } if (isSelected) { isSelected = false; } }
public void OnClickButton() { Debug.Log(Monster.Keyword); if (_hostserver.CurrentState == State.MonsterPhase) { if (Monster != null) { if (!isSelected) { SkillType type = Monster.Type; Color c = Color.white; switch (type) { case SkillType.neutral: c = (Resources.Load("Material/Monster-neutral", typeof(Material)) as Material).color; Monster.GetComponentInChildren <MeshRenderer>().materials[1].SetFloat("_MKGlowPower", 0.30f); break; case SkillType.darkness: c = (Resources.Load("Material/Monster-darkness", typeof(Material)) as Material).color; Monster.GetComponentInChildren <MeshRenderer>().materials[1].SetFloat("_MKGlowPower", 0.80f); break; case SkillType.evil: c = (Resources.Load("Material/Monster-evil", typeof(Material)) as Material).color; Monster.GetComponentInChildren <MeshRenderer>().materials[1].SetFloat("_MKGlowPower", 0.80f); break; case SkillType.holy: c = (Resources.Load("Material/Monster-holy", typeof(Material)) as Material).color; Monster.GetComponentInChildren <MeshRenderer>().materials[1].SetFloat("_MKGlowPower", 0.20f); break; case SkillType.lightness: c = (Resources.Load("Material/Monster-lightness", typeof(Material)) as Material).color; Monster.GetComponentInChildren <MeshRenderer>().materials[1].SetFloat("_MKGlowPower", 0.20f); break; } GetComponent <Image>().color = c; isSelected = true; } else { Monster.GetComponentInChildren <MeshRenderer>().materials[1].SetFloat("_MKGlowPower", 0.0f); GetComponent <Image>().color = new Color(1.0f, 1.0f, 1.0f, 0.2f); isSelected = false; } } } if (_hostserver.CurrentState == State.CastPhase) { IVPlayer p = _game.myPlayer.GetComponent <IVPlayer>(); if (!isSelected) { p.SentenceInventory.Add(keyword); isSelected = true; } else { p.SentenceInventory.Remove(keyword); isSelected = false; } } }
public void SetOwner(IVPlayer player) { this.player = player; }