public EnemyShipController PrefabInstantiate(PlanetController planet, Vector2 orbit, Vector2 position, bool immobile) { EnemyShipController ship = ((GameObject)Object.Instantiate(gameObject)).GetComponent <EnemyShipController>(); FlyController fly = ship.GetComponent <FlyController>(); PointGravityController pgrav = ship.GetComponent <PointGravityController>(); HullController hull = ship.GetComponent <HullController>(); Animator anim = ship.GetComponent <Animator>(); ship.PrefabName = name; if (immobile) { ship.state = Modes.Appearing; ship.GetComponent <Rigidbody2D>().isKinematic = hull.InitialShieldPower > 0; ship.transform.position = orbit; fly.enabled = false; pgrav.enabled = false; GetComponent <Collider2D>().enabled = false; anim.SetTrigger("Appear"); } else { ship.state = Modes.Flying; fly.PrepareFly(orbit, planet); ship.transform.position = position; } ship.Planet = planet; return(ship); }
void Awake() { hull = GetComponent <HullController>(); flyController = GetComponent <FlyController>(); flyController.OnFlyingComplete += OnFlyComplete; camController = Camera.main.GetComponent <CameraController>(); animator = GetComponent <Animator>(); }
void Awake() { EnemyShips = 0; hull = GetComponent <HullController>(); multiplier = GetComponent <MultiplierController>(); gun = GetComponentInChildren <GunController>(); UI.HpBar.HP = hull.MaxHp; }