コード例 #1
0
        public TransportMechanism IdentifyRobotPart(RobotPart robotPart)
        {
            switch (robotPart.RobotPartCategory)
            {
            case RobotPartCategory.Assembly:
                return(new AssemblyRoomTransportMechanism((Assembly)robotPart));

            case RobotPartCategory.Weapon:
                return(new ArmouryTransportMechanism((Weapon)robotPart));
            }
            throw new NotImplementedException("I can't identify this component!");
        }
コード例 #2
0
        public void IdentifyRobotPart(RobotPart robotPart)
        {
            switch (robotPart.RobotPartCategory)
            {
            case RobotPartCategory.Assembly:
                _transportMechanism = new AssemblyRoomTransportMechanism();
                break;

            case RobotPartCategory.Weapon:
                _transportMechanism = new ArmouryTransportMechanism();
                break;
            }
        }
コード例 #3
0
 public void PickUpRobotPart(RobotPart robotPart)
 {
     _robotParts.Add(robotPart);
     IdentifyRobotPart(robotPart);
 }
コード例 #4
0
 public void AddRobotPart(RobotPart robotPart)
 {
     _robotParts.Add(robotPart);
 }
コード例 #5
0
        public void PickUpRobotPart(RobotPart robotPart)
        {
            var transportMechanism = IdentifyRobotPart(robotPart);

            _transportMechanisms.Add(transportMechanism);
        }