private void Update() { //回复 护盾值 attributes.SheildPoint += attributes.SPRegenerationRate.Value * Time.deltaTime; if (attributes.data.IsCaster) { //回复 魔法值 和 当前技能冷却(应当是全体技能冷却,同时技能初始精确度未设置) attributes.ManaPoint.Value += attributes.MPRegenerationRate.Value * Time.deltaTime; skillTable.CurrentSkill.AccuracyCooldown(Time.deltaTime); } //触发buff效果 BuffEvent?.Invoke(); if (GameCtrl.IsOnlineGame && IsLocal) { if (Gamef.SystemTimeInMillisecond - lastSyncUnitStateInstant >= GameDB.SYNC_TRANSFORM_INTERVAL) { Debug.Log("Send Hp = " + attributes.SheildPoint + ", Mp = " + attributes.ManaPoint.Value); lastSyncUnitStateInstant = Gamef.SystemTimeInMillisecond; DataSync.SyncHP(this, lastSyncUnitStateInstant, attributes.SheildPoint); DataSync.SyncMP(this, lastSyncUnitStateInstant, attributes.ManaPoint.Value); } } ////单位画布面对摄像机 //if (unitCanvas != null) // unitCanvas.transform.forward = unitCamera.position - unitCanvas.transform.position; }
void BuffEventHandler(BuffEvent e) { if (round == 1 && first_buff[e.playerIndex]) { EventBus.Publish <PlayerProgressEvent>(new PlayerProgressEvent("first buff", e.playerIndex)); first_buff[e.playerIndex] = false; } }
public void OnEvent(object obj) { Console.WriteLine("======OnEvent======{0}", obj); if (obj is Player) { Player p = obj as Player; DB.Insert("insert into * from test"); } else if (obj is BuffEvent) { BuffEvent buff = obj as BuffEvent; DB.Query("select * from test"); } }
// void Move() { // //Temporary, will move to controllers // Vector2 velocity = Vector2.zero; // velocity.x = Input.GetAxis("Horizontal" + PlayerID.ToString()); // velocity.y = Input.GetAxis("Vertical" + PlayerID.ToString()); // rb.velocity = MoveSpeed * velocity.normalized; // } // void Prune() { // if (InputController.PrunePressed(PlayerID)){ // List<BranchController> deletion_list = new List<BranchController>(); // foreach (var branch in selected_branches) { // if (!branch) { // deletion_list.Add(branch); // continue; // } // resource += branch.Damage(1000); // EventBus.Publish<ResourceChangeEvent>(new ResourceChangeEvent(PlayerID, resource)); // } // foreach (var branch in deletion_list) { // selected_branches.Remove(branch); // } // } // } // void Grow() { // if (InputController.GrowPressed(PlayerID)){ // List<BranchController> deletion_list = new List<BranchController>(); // foreach (var branch in selected_branches) { // if (!branch) { // deletion_list.Add(branch); // continue; // } // resource -= branch.Grow(resource); // EventBus.Publish<ResourceChangeEvent>(new ResourceChangeEvent(PlayerID, resource)); // } // foreach (var branch in deletion_list) { // selected_branches.Remove(branch); // } // } // } // void Bomb() { // if (InputController.BombPressed(PlayerID)) { // GameObject bombIns = Instantiate(bomb, transform.position, Quaternion.identity); // bombIns.GetComponent<BombController>().PlayerID = PlayerID; // } // } void _OnBuffUpdated(BuffEvent e) { if (e.playerIndex == PlayerID) { switch (e.type) { // make sure only one speeding buff is exist at one time case BuffController.buffType.speedDown: if (isSpeedingUp) { isSpeedingUp = false; curBuffTime = 0f; } if (isSpeedingDown) { curBuffTime = e.effectiveTime; duration = e.duration; } else { isSpeedingDown = true; curBuffTime = e.effectiveTime; duration = e.duration; } break; case BuffController.buffType.speedUp: if (isSpeedingDown) { isSpeedingDown = false; curBuffTime = 0f; } if (isSpeedingUp) { curBuffTime = e.effectiveTime; duration = e.duration; } else { isSpeedingUp = true; curBuffTime = e.effectiveTime; duration = e.duration; } break; } } }
void _OnBuffUpdated(BuffEvent e) { if (e.playerIndex == PlayerID) { switch (e.type) { case BuffController.buffType.resourceUp: resource += e.resourceNum; EventBus.Publish <ResourceChangeEvent>(new ResourceChangeEvent(PlayerID, resource)); break; case BuffController.buffType.speedUp: NaturalGrowth += e.SpeedUP; EventBus.Publish <SpeedChangeEvent>(new SpeedChangeEvent(PlayerID, NaturalGrowth)); break; } } }
private void Update() { //回复 护盾值 attributes.SheildPoint += attributes.SPRegenerationRate.Value * Time.deltaTime; if (attributes.data.IsCaster) { //回复 魔法值 和 当前技能冷却(应当是全体技能冷却,同时技能初始精确度未设置) attributes.ManaPoint.Value += attributes.MPRegenerationRate.Value * Time.deltaTime; skillTable.CurrentSkill.AccuracyCooldown(Time.deltaTime); } //触发buff效果 BuffEvent?.Invoke(); ////单位画布面对摄像机 //if (unitCanvas != null) // unitCanvas.transform.forward = unitCamera.position - unitCanvas.transform.position; }
public void SubscribeToBuffEquippedEvent(BuffEvent e) { BuffEquippedEvent += e; }