private void Awake()
 {
     ship                 = GameObject.FindWithTag(ShipDriver.Tag).GetComponent <ShipDriver>();
     laneLength           = GameObject.FindWithTag(TrackBuilder.Tag).GetComponent <SectionBuilder>().laneLength;
     obstacleLength       = obstacle.GetComponent <MeshRenderer>().bounds.size.z;
     maximumNudgeDistance = laneLength - obstacleLength;
 }
示例#2
0
    public CustomShipInitializerModel(string model, ShipDriver driver)
    {
        var cs = new CompactSerializer();

        this.model  = cs.Deserialize <ShipSystemModel>(model);
        this.driver = driver;
    }
示例#3
0
 public ShipController SetShip(ShipSystemModel model, ShipDriver driver)
 {
     this.ship = gameObject.AddComponent <ShipController>();
     this.ship.SetShip(shipClass, model, driver);
     SetHull(model.hull, this.ship.shipSystem.system, driver);
     this.ship.SetComponents(tackles.Select(t => t.GetComponent <ShipComponentBehaviour>()).Where(c => c != null).ToArray());
     return(this.ship);
 }
示例#4
0
    public FirePoints(int maxPoints, ShipDriver driver)
    {
        maxPoints = maxPoints < 1 ? 1 : maxPoints;

        points = new Vector3[maxPoints];

        this.driver = driver;
    }
示例#5
0
 private void Awake()
 {
     StartPoint = transform.Find("StartPoint");
     EndPoint   = transform.Find("EndPoint");
     Threshold  = transform.Find("Threshold");
     ship       = GameObject.FindWithTag("Player").GetComponent <ShipDriver>();
     track      = GameObject.FindWithTag("Track").GetComponent <TrackBuilder>();
 }
示例#6
0
 public BirdsState()
 {
     birdSpawner       = (GameObject)Resources.Load("BirdSpawner");
     birdTightSpawner  = (GameObject)Resources.Load("BirdTightSpawner");
     birdBomberSpawner = (GameObject)Resources.Load("BirdBomberSpawner");
     hpSpawner         = (GameObject)Resources.Load("HpSpawner");
     spawnerOffset     = new Vector3(57, 5, 0);
     sd = ShipDriver.Get();
 }
示例#7
0
 void Start()
 {
     sd = GetComponent <ShipDriver>();
     sd.HPChanged.AddListener(OnHpChanged);
     lastHP             = 5;
     cd                 = transform.GetComponentInChildren <CaptainDriver>();
     crankSource.volume = 0;
     crankSource.Play();
 }
示例#8
0
 public LearnEngineState(int ram, int shoot)
 {
     ramCount              = ram;
     shootCount            = shoot;
     engineTrainingSpawner = (GameObject)Resources.Load("EngineTrainingSpawner");
     shootTrainingSpawner  = (GameObject)Resources.Load("ShootTrainingSpawner");
     spawnerOffset         = new Vector3(57, 5, 0);
     sd = ShipDriver.Get();
     cd = CaptainDriver.Get();
 }
示例#9
0
 public DropoffState()
 {
     dockingShip = (GameObject)Resources.Load("DockingShip");
     //birdSpawner = (GameObject)Resources.Load("BirdSpawner");
     //birdTightSpawner = (GameObject)Resources.Load("BirdTightSpawner");
     //birdBomberSpawner = (GameObject)Resources.Load("BirdBomberSpawner");
     //hpSpawner = (GameObject)Resources.Load("HpSpawner");
     spawnerOffset = new Vector3(50, 5, 0);
     sd            = ShipDriver.Get();
 }
示例#10
0
    public void SetShip(int shipClass, ShipSystemModel model, ShipDriver driver)
    {
        GetComponent <Rigidbody>().mass = Mathf.Pow(2, shipClass);
        shipDriver     = driver;
        shipSystem     = new ShipSystem(model);
        this.shipClass = shipClass;
        maxHealth      = new float[] { 1f, 4f, 12f, 36f, 250f * ((BattleConfig)GameState.sharedData["BattleConfig"]).battleDurationMultipier }[shipClass];// Mathf.Pow(maxHealth, shipClass + 1);
        health         = maxHealth;

        shipDriver.SetShip(this); //turn enabled true

        gameObject.AddComponent <ShipIdentification>().ship = this;
    }
示例#11
0
    public void SetHull(HullModel model, Forest <SystemLink> link, ShipDriver driver)
    {
        var t = model.GetTackles(link);

        foreach (var e in t)
        {
            SetTackle(e.Key, e.Value)
            .SetDriver(driver);
        }
        foreach (var l in link.ByElements())
        {
            l.enabled = true;
        }
    }
 void Start()
 {
     ss = GetComponent <StraightSpin>();
     ShipDriver.Get().EnginePowerChanged.AddListener(OnEngineChanged);
 }
示例#13
0
 public LearnMovementState()
 {
     sd = ShipDriver.Get();
     cd = CaptainDriver.Get();
 }
示例#14
0
 public IntroState()
 {
     sd = ShipDriver.Get();
     cd = CaptainDriver.Get();
 }
示例#15
0
 public void AddToDead(ShipDriver driver, ShipController killer)
 {
     shipsLost[driver.shipClass]++;
     casualties.Add(killer);
     _deadDrivers.Add(driver);
 }
示例#16
0
 public void SetDriver(ShipDriver driver)
 {
     this.driver = driver;
 }
示例#17
0
 public static void EndChange(ShipDriver shipDriver)
 {
     shipDriver.EndChange();
 }
示例#18
0
 public static void StartChange(ShipDriver shipDriver, LaneChangeType type)
 {
     shipDriver.StartChange(type);
 }
示例#19
0
 public CustomShipInitializerModel(ShipSystemModel model, ShipDriver driver)
 {
     this.model  = model;
     this.driver = driver;
 }