示例#1
0
 public War_Vehicle(int numberOfStorageModules, int numberOfWeaponModules, int numberOfToolModules)
 {
     _canFly = true;
     _numberOfStorageModules = numberOfStorageModules;
     _numberOfWeaponModules  = numberOfWeaponModules;
     _numberOfToolModules    = numberOfToolModules;
     _moduleList             = new Vehicle_Module_List();
 }
    // Use this for initialization
    void Start()
    {
        //_baseLocation = transform.position;
        // Let's set vehicle stuff here
        _vehicle = new Vehicle();
        switch (_vehicleType)
        {
        case 1:
            _vehicleName   = "War Vehicle";
            _War_vehicle   = new War_Vehicle(1, 2, 0);
            _storageNumber = _War_vehicle._numberOfStorageModules;
            _weaponNumber  = _War_vehicle._numberOfWeaponModules;
            _toolNumber    = _War_vehicle._numberOfToolModules;
            _vehicleSpeed  = .4f;
            break;

        case 2:
            _vehicleName        = "Space Miner Vehicle";
            _SpaceMiner_vehicle = new Space_Miner_Vehicle(2, 0, 1);
            _storageNumber      = _SpaceMiner_vehicle._numberOfStorageModules;
            _weaponNumber       = _SpaceMiner_vehicle._numberOfWeaponModules;
            _toolNumber         = _SpaceMiner_vehicle._numberOfToolModules;

            _vehicle_Module_List = new Vehicle_Module_List();
            Storage_Vehicle_Module mod = new Storage_Vehicle_Module("Cargo module", 3);
            _vehicle_Module_List.AddStorageModule(mod);
            mod = new Storage_Vehicle_Module("Cargo module 2", 5);
            _vehicle_Module_List.AddStorageModule(mod);
            _currentStorageModule = 0;
            _minerHasFullLoad     = false;

            _vehicleSpeed         = 3.3f;
            _miningPickUpDuration = 3f;
            _miningUnloadDuration = 2f;
            _lastTimerTrigger     = Time.time;
            Miner_FindAndLinkClosestSpaceStation();
            break;

        case 3:
            _vehicleName             = "Space Passanger Vehicle";
            _SpacePassanger_Vechicle = new Space_Passanger_Vehicle(3, 0, 0);
            _storageNumber           = _SpacePassanger_Vechicle._numberOfStorageModules;
            _weaponNumber            = _SpacePassanger_Vechicle._numberOfWeaponModules;
            _toolNumber = _SpacePassanger_Vechicle._numberOfToolModules;

            _vehicle_Module_List = new Vehicle_Module_List();

            Storage_Vehicle_Module passangerModule = new Storage_Vehicle_Module("Passanger module", 3);
            _vehicle_Module_List.AddStorageModule(passangerModule);
            mod = new Storage_Vehicle_Module("Passanger module", 5);
            _vehicle_Module_List.AddStorageModule(passangerModule);
            mod = new Storage_Vehicle_Module("Passanger module", 2);
            _vehicle_Module_List.AddStorageModule(passangerModule);

            _vehicleSpeed     = 5f;
            _lastTimerTrigger = Time.time;

            _currentStorageModule    = 0;
            _passangerRouteWaypoints = new Vector3[4] {
                transform.position, transform.position, transform.position, transform.position
            };
            _passangerCurrentWaypoint = 0;
            // Set starting location to where vehicle was initially.
            Passanger_SetStartTargetLocation(transform.position);
            Passanger_SetEndTargetLocation(new Vector3(98, 0, 98));
            _passangerToStart            = false;
            _passangerToEnd              = true;
            _passangerVehicleLoadingTime = 6f;

            break;
        }

        _rb = GetComponent <Rigidbody>();

        _isMoving    = false;
        _hasTarget   = false;
        _hasLoad     = false;
        _isReturning = false;
    }