Example #1
0
        void OnRoleDying(RoleController roleController)
        {
            // 角色死亡, 活着的角色 -1 add by TangJian 2019/4/2 15:16
            RoleAliveCount--;

            // 怪物数目, 去除玩家 add by TangJian 2019/4/16 14:41
            if (roleController.CompareTag("Role") && !roleController.CompareTag("Player"))
            {
                MonsterAliveCount--;
            }

            OnSceneRoleDying?.Invoke(roleController);
        }
Example #2
0
        public void RemoveRoleController(RoleController roleController)
        {
            RoleControllerList.Remove(roleController);

            roleController.OnDying -= OnRoleDying;

            // 角色离开, 如果角色没死, 活着的角色 -1 add by TangJian 2019/4/2 15:15
            if (roleController.IsDead == false)
            {
                RoleAliveCount--;

                // 怪物数目, 去除玩家 add by TangJian 2019/4/16 14:41
                if (roleController.CompareTag("Role") && !roleController.CompareTag("Player"))
                {
                    MonsterAliveCount--;
                }
            }
        }
Example #3
0
        public void AddRoleController(RoleController roleController)
        {
            RoleControllerList.Add(roleController);

            // 注册角色死亡事件 add by TangJian 2019/4/2 15:13
            roleController.OnDying += OnRoleDying;

            // 判断新加入的角色是否死亡 角色没死, 活着的角色数目 +1 add by TangJian 2019/4/2 15:14
            if (roleController.IsDead == false)
            {
                RoleAliveCount++;

                // 怪物数目, 去除玩家 add by TangJian 2019/4/16 14:41
                if (roleController.CompareTag("Role") && !roleController.CompareTag("Player"))
                {
                    MonsterAliveCount++;
                }
            }
        }