/// <summary> /// Constructs a new player. /// </summary> public Player(Vector2 position, int energy, int initialWorldAreaId) : base(position) { // Load animated textures. this._playerAnimation = new PlayerAnimation(this); this._weapon1 = new StandardPlayerWeapon(); this._weapon2 = new MineLayer(); this.Energy = energy; this._worldAreaIdsVisited.Add(initialWorldAreaId); Reset(); this.MovementBoundary = GlobalServices.BoundMovementFactory.GetWorldBoundary(); this.Properties.Set(GameObjectProperties.Capability, ObjectCapability.CanPushOrCauseBounceBack); this.Properties.Set(GameObjectProperties.DrawOrder, (int)SpriteDrawOrder.Player); }
void Awake() { //定义本窗体的性质(默认数值,可以不写) base.UIForm_Type = UIFormType.Normal; base.UIForm_ShowMode = UIFormShowMode.Normal; base.UIForm_LucencyType = UIFormLucenyType.Lucency; // 观察者注册 playerWeapon = GameMainProgram.Instance.playerMgr.CurrentPlayer.PlayerMedi.PlayerWeapon; currentBulletCount.text = playerWeapon.CurrentBulletCount.ToString(); remainingBulletCount.text = playerWeapon.RemainingBulletCount.ToString(); clipBulletCount.text = playerWeapon.CilpBulletCount.ToString(); // 进行初始化 GameMainProgram.Instance.eventMgr.StartListening(EventName.BulletCount, this.UpdateUI); UpdateUI(); }
/// <summary> /// Constructs a new player. /// </summary> public Player(World world, Vector2 position, int energy) : base(world, position) { // Load animated textures. this._leftRightMovingAnimation = Animation.LoopingAnimation(World, "Sprites/Player/PlayerLeftFacing", 1); this._upMovingAnimation = Animation.LoopingAnimation(World, "Sprites/Player/PlayerUpFacing", 1); this._downMovingAnimation = Animation.LoopingAnimation(World, "Sprites/Player/PlayerDownFacing", 1); this._leftRightStaticAnimation = Animation.StaticAnimation(World, "Sprites/Player/PlayerLeftFacing"); this._upStaticAnimation = Animation.StaticAnimation(World, "Sprites/Player/PlayerUpFacing"); this._downStaticAnimation = Animation.StaticAnimation(World, "Sprites/Player/PlayerDownFacing"); Ap.NewFrame += PlayerSpriteNewFrame; this._weapon1 = new StandardPlayerWeapon(); this._weapon2 = new MineLayer(); Reset(position, energy); this._playerMovesFootOne = world.Game.SoundPlayer.GetSoundEffectInstance(GameSound.PlayerMoves); this._playerMovesFootTwo = world.Game.SoundPlayer.GetSoundEffectInstance(GameSound.PlayerMoves); this._playerMovesFootTwo.Pitch = -0.15f; }
private void Start() { playerweapon = GetComponent <IPlayerWeapon>(); playerLifeTotal = SettingContext.CurrentSetting.PlayerLife; PlayerBoomTotal = SettingContext.CurrentSetting.PlayerBoom; }