示例#1
0
        public static void SendCommand(GameObjectCommand command)
        {
            NetworkCommandObject completeCommand = new NetworkCommandObject()
            {
                ClientId = instance.NetReference.ClientId,
                Command = command,
                CommandType = NetworkCommandType.GameObjectCommand,
            };

            instance.NetReference.Input.Add(completeCommand);
        }
示例#2
0
        public static GameObject BuildFromNetwork(GameObjectCommand command)
        {
            CreateParameters parameters = (CreateParameters)command.Parameters;

            switch (parameters.ConstructorId)
            {
                case "Player":
                    {
                        return PlayerFactory.Instance.GetNetworkPlayer(parameters.ID);
                    }
                case "Tower":
                    {
                        return TowerFactory.Instance.GetFriendlyAOEHealingTower(true, parameters.ID);
                    }
                case "Enemy":
                    {
                        return PlayerFactory.Instance.GetEnemyFootSoldier(parameters.ID);
                    }
                default:
                    {
                        throw new Exception("The Object Hasn't Been Set up to be created throug hthe network yet");
                    }
            }
        }
示例#3
0
 //public void HandleHitBySkill(Skill skill)
 //{
 //    if (Combat != null)
 //    {
 //        Combat.HandleHitBySkill(skill);
 //    }
 //}
 public void UpdateFromNetworkParams(GameObjectCommand command)
 {
     switch (command.ReceivingComponent)
     {
         case GameObjectComponentType.Brain:
             {
                 Brain.ReceiveCommand(command);
             }
             break;
         case GameObjectComponentType.Combat:
             {
                 Combat.ReceiveCommand(command);
             }
             break;
         case GameObjectComponentType.Physics:
             {
                 Physics.ReceiveCommand(command);
             }
             break;
         case GameObjectComponentType.Renderer:
             {
                 Renderer.ReceiveCommand(command);
             }
             break;
         default:
             {
                 throw new NotImplementedException("No Component By This Enumeration");
             }
     }
 }