public void LaunchBomb(BombLauncher owner, float bombTimeout) { _owner = owner; _isActive = true; _detonationTime = Time.time + bombTimeout; Prethrust(); }
void Start() { gameMarker = GameObject.Find("Game Root/GameMarker"); currentStunDuration = maxStunDuration; myRigidbody = GetComponent <Rigidbody2D>(); players.Add(gameObject); playerHitState = gameObject.AddComponent <PlayerHitState>() as PlayerHitState; playerHitState.player = gameObject; GameObject vulcanObject = Instantiate(Resources.Load("Vulcan"), transform.position, Quaternion.identity) as GameObject; vulcanObject.transform.parent = transform; vulcan = vulcanObject.GetComponent <Vulcan>() as Vulcan; vulcan.player = this; GameObject bombLauncherObject = Instantiate(Resources.Load("Bomb Launcher"), transform.position, Quaternion.identity) as GameObject; bombLauncherObject.transform.parent = transform; bombLauncher = bombLauncherObject.GetComponent <BombLauncher>() as BombLauncher; bombLauncher.player = this; shotgun = gameObject.AddComponent <Shotgun>() as Shotgun; shotgun.player = this; gigaBeam = gameObject.AddComponent <GigaBeam>() as GigaBeam; gigaBeam.player = this; magnetMissile = gameObject.AddComponent <MagnetMissile>() as MagnetMissile; magnetMissile.player = this; reversePosition = GetComponent <Entity>().affinity.GetComponent <Fleet>().reversePosition; body = transform.Find("Body").gameObject; body.GetComponent <SpriteRenderer>().color = GetComponent <Entity>().affinity.GetComponent <Fleet>().teamColor; shieldObject = Instantiate(shieldPrefab, transform.position, Quaternion.identity) as GameObject; shieldObject.transform.parent = gameObject.transform; shield = shieldObject.GetComponent <Shield>(); shield.player = this; playerHitState.SwitchToInvincible(); damageBehavior = GetComponent <DamageBehavior>(); currentExValue = GetComponent <Entity>().affinity.GetComponent <Fleet>().lastExValue; gameObject.transform.eulerAngles = new Vector3( gameObject.transform.eulerAngles.x, gameObject.transform.eulerAngles.y, gameObject.transform.eulerAngles.z - 90); vehicleControls = GetComponent <VehicleControls>(); if (reversePosition) { reverseIndex *= -1; } GameObject playerHud = Instantiate(Resources.Load("HUD/PlayerHUD"), transform.position, Quaternion.identity) as GameObject; playerHud.transform.parent = GameObject.Find("WorldspaceHUD").transform; playerHud.GetComponent <PlayerHUD>().player = this; defaultColor = body.GetComponent <SpriteRenderer>().color; foreach (Transform child in body.transform) { CarWheel wheel = child.GetComponent <CarWheel>(); if (wheel) { wheel.vehicleControls = vehicleControls; } } currentExValue = maxExValue; }
private void Awake() { if (_instance != null) { Component.Destroy(this); return; } _instance = this; }
// Use this for initialization void Start() { Debug.Log("CODE A SUPPRIMER"); //Character character = GetComponent <IsometricCharacter> (); //Weapon bombLauncher = GetComponentInChildren <BombLauncher> (); cameraRight = Quaternion.Euler(new Vector3(0, 90, 0)) * cameraForward; }
void Init() { _transform = transform; _target = _transform.position; _speed = 3f; _speedMax = 7f; _isImmortal = false; _isDead = false; GameObject cam = new GameObject("Camera"); cam.transform.SetParent(_transform); cam.transform.localPosition = Vector2.zero; Camera camComp = cam.AddComponent <Camera>(); camComp.backgroundColor = Color.black; camComp.orthographic = true; camComp.orthographicSize = 5f; camComp.nearClipPlane = 0f; _bombLauncher = GetComponent <BombLauncher>(); }
void Start() { gameMarker = GameObject.Find("Game Root/GameMarker"); currentStunDuration = maxStunDuration; myRigidbody = GetComponent<Rigidbody2D>(); players.Add (gameObject); playerHitState = gameObject.AddComponent<PlayerHitState>() as PlayerHitState; playerHitState.player = gameObject; GameObject vulcanObject = Instantiate (Resources.Load ("Vulcan"), transform.position, Quaternion.identity) as GameObject; vulcanObject.transform.parent = transform; vulcan = vulcanObject.GetComponent<Vulcan>() as Vulcan; vulcan.player = this; GameObject bombLauncherObject = Instantiate (Resources.Load ("Bomb Launcher"), transform.position, Quaternion.identity) as GameObject; bombLauncherObject.transform.parent = transform; bombLauncher = bombLauncherObject.GetComponent<BombLauncher>() as BombLauncher; bombLauncher.player = this; shotgun = gameObject.AddComponent<Shotgun>() as Shotgun; shotgun.player = this; gigaBeam = gameObject.AddComponent<GigaBeam>() as GigaBeam; gigaBeam.player = this; magnetMissile = gameObject.AddComponent<MagnetMissile>() as MagnetMissile; magnetMissile.player = this; reversePosition = GetComponent<Entity>().affinity.GetComponent<Fleet>().reversePosition; body = transform.Find ("Body").gameObject; body.GetComponent<SpriteRenderer>().color = GetComponent<Entity>().affinity.GetComponent<Fleet>().teamColor; shieldObject = Instantiate (shieldPrefab, transform.position, Quaternion.identity) as GameObject; shieldObject.transform.parent = gameObject.transform; shield = shieldObject.GetComponent<Shield>(); shield.player = this; playerHitState.SwitchToInvincible(); damageBehavior = GetComponent<DamageBehavior>(); currentExValue = GetComponent<Entity>().affinity.GetComponent<Fleet>().lastExValue; gameObject.transform.eulerAngles = new Vector3( gameObject.transform.eulerAngles.x, gameObject.transform.eulerAngles.y, gameObject.transform.eulerAngles.z - 90); vehicleControls = GetComponent<VehicleControls>(); if(reversePosition) reverseIndex *= -1; GameObject playerHud = Instantiate (Resources.Load ("HUD/PlayerHUD"), transform.position, Quaternion.identity) as GameObject; playerHud.transform.parent = GameObject.Find ("WorldspaceHUD").transform; playerHud.GetComponent<PlayerHUD>().player = this; defaultColor = body.GetComponent<SpriteRenderer>().color; foreach(Transform child in body.transform){ CarWheel wheel = child.GetComponent<CarWheel>(); if(wheel){ wheel.vehicleControls = vehicleControls; } } currentExValue = maxExValue; }
public void Draw() { Background.Draw(_location); if (_selectedItem != null) { if (_selectedItem.Width > 8) { _selectedItem.Draw(_location + SelectedItemLocation16_16); } else { _selectedItem.Draw(_location + SelectedItemLocation8_16); } } if (_agent.Player.Inventory.HasBoomerang) { Boomerang.Draw(BoomerangLocation + GridLocation + _location); } if (_agent.Player.Inventory.BombCount >= 1) { Bomb.Draw(BombLocation + GridLocation + _location); } if (_agent.Player.Inventory.ArrowLevel == Secondary.SilverArrow) { SilverArrow.Draw(ArrowLocation + GridLocation + _location); } else if (_agent.Player.Inventory.ArrowLevel == Secondary.Arrow) { Arrow.Draw(ArrowLocation + GridLocation + _location); } if (_agent.Player.Inventory.BowLevel == Secondary.FireBow) { FireBow.Draw(BowLocation + GridLocation + _location); } else if (_agent.Player.Inventory.BowLevel == Secondary.Bow) { Bow.Draw(BowLocation + GridLocation + _location); } if (_agent.Player.Inventory.Coins >= 2) { AlchemyCoin.Draw(CoinLocation + GridLocation + _location); } if (_agent.Player.Inventory.HasATWBoomerang) { ATWBoomerang.Draw(ATWBoomerangLocation + GridLocation + _location); } if (_agent.Player.Inventory.HasBombLauncher) { BombLauncher.Draw(BombLauncherLocation + GridLocation + _location); } DrawExtraItem(_slot7Sprite, Slot7Location); DrawExtraItem(_slot8Sprite, Slot8Location); CursorGrid.Draw(CursorSize * _cursorPosition.ToVector2() + GridLocation + _location); }