private void Awake() { m_OwnedEnemies = new List <Enemy>(); m_InitScale = transform.localScale; m_ScreenUnitsHeight = Camera.main.orthographicSize * 2f; float aspectRatio = (float)Screen.width / (float)Screen.height; m_ScreenUnitsWidth = m_ScreenUnitsHeight * aspectRatio; m_ScreenMoveMin = new Vector2(-m_ScreenUnitsWidth * .5f + 1f, -m_ScreenUnitsHeight * .5f + 1f); m_ScreenMoveMax = new Vector2(m_ScreenUnitsWidth * .5f - 1f, m_ScreenUnitsHeight * .5f - 1f); m_GoToPointer = Instantiate(m_GoToPointerPrefab, m_ScreenRoot); m_GoToPointer.SetActive(false); m_JumpBoostLeftArrow.gameObject.SetActive(false); m_JumpBoostRightArrow.gameObject.SetActive(false); GameObject spearObj = Instantiate(m_PlayerSpearPrefab); m_PlayerSpear = spearObj.GetComponent <PlayerSpear>(); m_PlayerSpear.transform.SetParent(transform, false); //m_PlayerSpear.Player = this; Enemy.OnSuccessfullyHijacked += OnSuccessfullyHijackedEnemy; GameHUD.OnLeaveOrEnterShipButtonTapped += OnEnterOrLeaveShipHUDButtonClicked; }
private void Awake() { GameObject spearObj = Instantiate(m_PlayerSpearPrefab); m_PlayerSpear = spearObj.GetComponent <PlayerSpear>(); m_PlayerSpear.transform.SetParent(transform, false); m_PlayerSpear.Player = this; m_PlayerSpear.FallingPlayerCam = m_FallingPlayerCam; ChangeToState(m_IdleState); }
protected override void PickUpObject(GameObject other) { base.PickUpObject(other); PickUpManager manager = other.GetComponent <PickUpManager>(); PlayerSpear spearComponent = spear.GetComponentInChildren <PlayerSpear>(); if (spearComponent.tagCustom == "Weapon") { if (manager.Weapons.Count <= 5) { manager.Weapons.Add(spear); } else { return; } } spearComponent.weaponDamage = setDamage; spearComponent.knockBackForce = setKnockBack; spearComponent.name = setName; spearComponent.tagCustom = setTag; Destroy(this.gameObject); }