private int ParseQuality(PlayerQuality quality, IElement mainContent, int i, IElement childElement) { if (childElement.ClassList.Contains("sk1")) { string title = childElement.Text(); IElement valueElement = mainContent.Children[++i]; if (valueElement.ClassList.Contains("sk2") || valueElement.ClassList.Contains("sk3")) { string value = valueElement.Text(); TrySetField <double>(title, value, "zkušenosti", val => quality.Experiences = val); TrySetField <int>(title, value, "celkem", val => quality.Sum = val); TrySetField <int>(title, value, "výdrž", val => quality.Stamina = val); TrySetField <int>(title, value, "brankář", val => quality.Goalkeeper = val); TrySetField <int>(title, value, "odebírání míče", val => quality.Tackling = val); TrySetField <int>(title, value, "hlavičky", val => quality.Header = val); TrySetField <int>(title, value, "křídlo", val => quality.Winger = val); TrySetField <int>(title, value, "tvořivost", val => quality.Creativity = val); TrySetField <int>(title, value, "přihrávky", val => quality.Passing = val); TrySetField <int>(title, value, "útok", val => quality.Attacker = val); } } return(i); }
// Use this for initialization void Start() { groundCheck = transform.Find("GroundCheck"); skillSystem = gameObject.AddComponent <PlayerSkillSystem>(); quality = new PlayerQuality(); gt = new GroundTrigger(this); }
private void Awake() { //跟一些游戏中的组件绑定 //技能相关发射器绑定 direction = new Vector2(-1, 0); //技能系统绑定 skillSystem = gameObject.AddComponent <PlayerSkillSystem>(); //封装一些角色数值的东西 quality = new PlayerQuality(); }
//这个动画效果本身是一个trigger 碰到其他带有敌人标签 则触发 private void OnTriggerEnter2D(Collider2D other) { //为敌人触发 if (other.tag == "Player" && !other.GetComponent <Player>().isLocalPlayer) { //用个小物件测试效果 PlayerQuality temp = other.GetComponent <Player>().quality; //调用技能拥有者 技能系统下的检查来调用被动技能buff baseSkill.owner.skillSystem.Check(other.transform); temp.HP -= baseSkill.damage; Destroy(this.gameObject); } }
//当在地面上时触发检测 修改角色属性值 public void GroundTrig() { if (ground) { PlayerQuality quality = player.quality; Tile targetObject = ground.collider.gameObject.GetComponent <Tile>(); if (targetObject != null) { //获取射线撞击目标的类型 Tile.TileType tileType = targetObject.GetTileType(); if (tileType == Tile.TileType.PLAIN) { quality.PropertyReset(); } else if (tileType == Tile.TileType.GRASS) { quality.PropertyReset(); quality.DownSpeed(); quality.dodge = 15; } else if (tileType == Tile.TileType.ICE) { quality.PropertyReset(); quality.UpSpeed(); quality.attack += 1; } else if (tileType == Tile.TileType.SWAMP) { quality.PropertyReset(); quality.DownSpeed(); quality.defend -= 1; } else if (tileType == Tile.TileType.RUINS) { } } else { quality.PropertyReset(); } } }
// Code that runs on entering the state. public void Start() { //获得网格图形组件 mesh = new Mesh(); //获取自组建Mask GetComponent <MeshFilter>().mesh = mesh; lod = levelOfDetails; width = range; player = transform.parent.GetComponent <Player>(); playerQuality = player.quality; //若loa为1,则共发射360条射线作为光线,则有360个顶点加个圆心 verts = new Vector3[(playerQuality.sightAngular / lod) + 1]; //每两个顶点跟圆心组成一个三角形,所以三角形的个数为定点数乘3 tris = new int[(playerQuality.sightAngular / lod) * 3]; uvs = new Vector2[verts.Length]; for (int i = 0; i < layerMask.Length; ++i) { mask |= layerMask[i]; } }
// Use this for initialization void Start() { playerQuality = GetComponentInParent <Player>().quality; set(); }
public Player(string name, int imageId, PlayerQuality currPlayerQuality) { Name = name; ImageId = imageId; CurrPlayerQuality = currPlayerQuality; }