void Awake() { PSS = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShipScript>(); _rb = GetComponent <Rigidbody2D>(); _damage = PSS._damage; _speed = 15; _timeToDestroy = 3; Destroyy(); _rb.AddForce(new Vector2(0, 1) * _speed, ForceMode2D.Impulse); }
void OnTriggerEnter(Collider c) { if (c.tag == "player") { PlayerShipScript PPS = c.GetComponent <PlayerShipScript>(); if (PPS != null) { PPS.DamageShip(1); } } }
// Use this for initialization void Start() { ship = PlayerShipScript.player; spriteRenderer = GetComponent<SpriteRenderer>(); startColor = spriteRenderer.color; //Ship is attached to the parent game object //ship = transform.parent.gameObject.GetComponent<PlayerShipScript>(); attaching = false; }
void Awake() { player = this; m_alive = true; InitShip(); // The camera is parented to a GO and offset on the Z axis // We're keeping the parent so we don't have to set the Z when moving the camera m_cameraTransform = Camera.main.transform.parent; }
// Use this for initialization void Start() { ship = PlayerShipScript.player; spriteRenderer = GetComponent <SpriteRenderer>(); startColor = spriteRenderer.color; //Ship is attached to the parent game object //ship = transform.parent.gameObject.GetComponent<PlayerShipScript>(); attaching = false; }
public Contract(string p_Name, string p_Description, string p_Title, string p_Reward) { contractObjectives = new List<GameObject> (); completed = false; objectivePosition = new Vector3 (Random.Range(-100,100), Random.Range(-100,100), 0); targetImagePath = "Image Directory"; targetShipImagePath = "ShipImage Directory"; name = p_Name; title = p_Title; description = p_Description; reward = p_Reward; player = GameObject.Find ("Player Ship").GetComponent<PlayerShipScript>(); }
public Contract() { contractObjectives = new List<GameObject> (); completed = false; objectivePosition = new Vector3 (Random.Range(-100,100), Random.Range(-25,25), 0); description = "Go here!"; targetImagePath = "Image Directory"; targetShipImagePath = "ShipImage Directory"; name = "Unknown"; title = "Unknown Title"; reward = "0 Space Dollars"; player = GameObject.Find ("Player Ship").GetComponent<PlayerShipScript>(); }
public Contract() { contractObjectives = new List <GameObject> (); completed = false; objectivePosition = new Vector3(Random.Range(-100, 100), Random.Range(-25, 25), 0); description = "Go here!"; targetImagePath = "Image Directory"; targetShipImagePath = "ShipImage Directory"; name = "Unknown"; title = "Unknown Title"; reward = "0 Space Dollars"; player = GameObject.Find("Player Ship").GetComponent <PlayerShipScript>(); }
public Contract(string p_Name, string p_Description, string p_Title, string p_Reward) { contractObjectives = new List <GameObject> (); completed = false; objectivePosition = new Vector3(Random.Range(-100, 100), Random.Range(-100, 100), 0); targetImagePath = "Image Directory"; targetShipImagePath = "ShipImage Directory"; name = p_Name; title = p_Title; description = p_Description; reward = p_Reward; player = GameObject.Find("Player Ship").GetComponent <PlayerShipScript>(); }
void Start() { EventManager.AddEventListener(EventDefs.PLAYER_HEALTH_UPDATE, UpdateHealth); EventManager.AddEventListener(EventDefs.PLAYER_SHIELD_UPDATE, UpdateShield); playerShip = PlayerShipScript.player; healthCicle.fillAmount = playerShip.MaxHealth / 100f; ShieldScript playerShield = playerShip.Shield; if (playerShield != null) { shieldCicle.fillAmount = playerShield.ShieldAmount.Remap(0f, playerShield.maxShieldAmount, 0f, 1f); m_playerShield = playerShield; } else { shieldCicle.gameObject.SetActive(false); } }
private void EnterCustomization() { //Focus camera on player Camera cam = Camera.main; oldCameraSize = cam.orthographicSize; cam.orthographicSize = 1.5f; ship = PlayerShipScript.player; ship.Dock(); CenterShip(); PopulateAttachmentPoints(); WeaponToggles.gameObject.SetActive(true); customizing = true; }
void Start() { EventManager.AddEventListener( EventDefs.PLAYER_HEALTH_UPDATE, UpdateHealth ); EventManager.AddEventListener( EventDefs.PLAYER_SHIELD_UPDATE, UpdateShield ); playerShip = PlayerShipScript.player; healthCicle.fillAmount = playerShip.MaxHealth/100f; ShieldScript playerShield = playerShip.Shield; if( playerShield != null ) { shieldCicle.fillAmount = playerShield.ShieldAmount.Remap(0f,playerShield.maxShieldAmount,0f,1f); m_playerShield = playerShield; } else { shieldCicle.gameObject.SetActive( false ); } }
//Eventually will spawn objectives based off contract public void SpawnContract(PlayerShipScript player) { GameObject contractObjective1 = (GameObject)GameObject.Instantiate(player.objectivePrefab, objectivePosition, Quaternion.identity); contractObjective1.GetComponent <ObjectiveEvent> ().ObjectiveContract = this; contractObjective1.GetComponent <ObjectiveEvent> ().init(ObjectiveEvent.ObjectiveType.KillTarget); SetUIMarker(contractObjective1); GameObject contractObjective2 = (GameObject)GameObject.Instantiate(player.objectivePrefab, objectivePosition, Quaternion.identity); contractObjective2.GetComponent <ObjectiveEvent> ().ObjectiveContract = this; contractObjective2.GetComponent <ObjectiveEvent> ().init(ObjectiveEvent.ObjectiveType.TurnInContract); contractObjective2.SetActive(false); contractObjective1.GetComponent <ObjectiveEvent> ().NextObjective = contractObjective2; contractObjectives.Add(contractObjective1); contractObjectives.Add(contractObjective2); }
void fetchShipReferences() { if (playerShip == null) { // canvas waits until the player ship spawns playerShip = GameObject.Find("Player Ship (Sloop)(Clone)"); if (playerShip == null) { playerShip = GameObject.Find("Player Ship (Frigate)(Clone)"); } if (playerShip != null) { playerShipScript = playerShip.GetComponent <PlayerShipScript>(); } } if (controlScript.activeEnemyShipEngagedReference != null) { enemyAIShipScript = controlScript.activeEnemyShipEngagedReference.GetComponent <shipAIScriptTugboat>(); } } // fetch all ship references
// Start is called before the first frame update void Start() { MyText = GetComponent <Text>(); PSS = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShipScript>(); }
//Eventually will spawn objectives based off contract public void SpawnContract(PlayerShipScript player) { GameObject contractObjective1 = (GameObject)GameObject.Instantiate (player.objectivePrefab, objectivePosition, Quaternion.identity); contractObjective1.GetComponent<ObjectiveEvent> ().ObjectiveContract = this; contractObjective1.GetComponent<ObjectiveEvent> ().init (ObjectiveEvent.ObjectiveType.KillTarget); SetUIMarker (contractObjective1); GameObject contractObjective2 = (GameObject)GameObject.Instantiate (player.objectivePrefab, objectivePosition, Quaternion.identity); contractObjective2.GetComponent<ObjectiveEvent> ().ObjectiveContract = this; contractObjective2.GetComponent<ObjectiveEvent> ().init (ObjectiveEvent.ObjectiveType.TurnInContract); contractObjective2.SetActive (false); contractObjective1.GetComponent<ObjectiveEvent> ().NextObjective = contractObjective2; contractObjectives.Add (contractObjective1); contractObjectives.Add (contractObjective2); }