public ShipViewModel(Ship ship) { this.Ship = ship; this.Condition = new ShipCondition(ship); this.CompositeDisposable.Add(this.Condition); }
private void FindTarget() { if (_enemyCondition != null) { return; } var ships = FindObjectsOfType <ShipCondition>(); foreach (var ship in ships) { if (ship.ShipType != _shipCondition?.ShipType) { _enemyCondition = ship; } } if (_enemyCondition == null) { return; } _destroyable.Clear(); var targets = _enemyCondition.GetComponentsInChildren <IDamageable>(); foreach (var target in targets) { var railing = target as RailingInteraction; if (railing && railing.Broken) { continue; } _destroyable.Add(target); } }
// Use this for initialization void Start() { stopWatch.Start(); EndLevelAtDistance = new int[NumberOfLevels + 1]; for (int i = 1; i <= NumberOfLevels; i++) { EndLevelAtDistance[i] = i * 50000; } TargetTime = new int[NumberOfLevels + 1]; for (int i = 1; i <= NumberOfLevels; i++) { TargetTime[i] = i * 20; } playerShip = GameObject.FindGameObjectWithTag("PlayerShip").GetComponent <ShipCondition>(); currentAstSpeed = StartingAsteroidSpeed; highestAstSpeed = currentAstSpeed; //First level only accessible from menu, levels play in order after that //levels can be skipped in the menu CurrentLevel = PlayerPrefs.GetInt("Level"); if (CurrentLevel < 0) { CurrentLevel = 0; } StartCoroutine("SpawnAsteroid"); StartCoroutine("CalculateDistance"); StartCoroutine("SpawnBonus"); }
private void GoFlight() { //Only activate ship after all systems are online //check hull //check engines //check weapons //check RigidBody if (Rb != null) { Log("RB Physics: ONLINE"); } else { Log("RB Physics: MISSING"); condition = ShipCondition.error; } //check hull if (HP > 0) { int integrity = 100 * HP / HPmax; Log("Hull Integrity Systems: ONLINE, " + integrity + "%"); } else { Log("Hull Integrity Systems: OFFLINE\nAbandon Ship!"); condition = ShipCondition.dead; return; } //Check Engines if (EnginePower > 0) { Log("Engines ONLINE: " + (EnginePower * 100) + "%"); condition = ShipCondition.active; } else { Log("Engines OFFLINE\nShip Adrift!"); condition = ShipCondition.adrift; } // 4. Check Weapons // a. if offline, is ship adrift? // i. if adrift, ship is disabled // ii. else ship is neutralized // 5. Ship is Active }
// Use this for initialization void Start() { manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); playerShip = GameObject.FindGameObjectWithTag("PlayerShip").GetComponent <ShipCondition>(); Vector3 newForce = new Vector3(0, 0, -1 * manager.GetCurrentAstSpeed()); GetComponent <Rigidbody>().AddForce(newForce); StartCoroutine("CheckForDeath"); }
private void Start() { _shipCondition = GetComponentInParent <ShipCondition>(); _particleSystem = GetComponentsInChildren <ParticleSystem>(); _spawnPos = GetComponentInChildren <ItemSpawn>(); _audioPool = FindObjectOfType <AudioSourcePoolManager>(); if (_spawnPos == null) { Debug.LogError("Missing spawn position script on children objects. You need to create a child game object and assign ItemSpawn script to it"); } }
public void Init(KrakenManager krakenManager) { _krakenManager = krakenManager; _krakenAttack = GetComponentInChildren <KrakenAttack>(); _health = _maxHealth; _anim = GetComponent <Animator>(); _attackDelay = Random.Range(3, 5); y = transform.position.y; var ships = FindObjectsOfType <ShipCondition>(); foreach (var ship in ships) { if (ship.ShipType == ShipType.Player) { _playerShip = ship; } } }
void Start() { _cannon = GetComponent <EnemyCannon>(); _ship = GetComponentInParent <ShipCondition>(); _delay = Random.Range(3f, 5f); }
void Start() { manager = GetComponent <GameManager>(); condition = GameObject.FindGameObjectWithTag("PlayerShip").GetComponent <ShipCondition>(); }
public ShipViewModel(Ship ship) { this.Ship = ship; this.Condition = new ShipCondition(ship); }