protected void Play() { DirectionParam dir = GetParam(DirectionParam.NAME) as DirectionParam; if (dir != null) { vo.direction = dir.direction; role.Play(StateName, dir.flipx); } else { role.Play(StateName); } }
override public void StartState(Dictionary <string, StateParam> param) { this.param = param; Play(); DirectionParam dir = GetParam(DirectionParam.NAME) as DirectionParam; string direction = dir != null ? dir.direction : vo.direction; float speed = 2f; //开枪时角色移动减慢 if (vo.gun != null && vo.gun.fireFlag) { speed = 1.5f; } r2d.velocity = new Vector2(direction == DirectionParam.RIGHT ? speed : -speed, r2d.velocity.y); }