// Use this for initialization void Start() { if (initialInfoCard != null) { Camera.main.GetComponent <CameraControl>().pauseAndDrawInfoCard(initialInfoCard); } if (startInCutscene) { enterCutscene(); } else { // Loads Prefabs directly from Resources Folder phoneBullet = ((GameObject)Resources.Load("Phone Attacks/Bullet")).transform; phoneLazerBeam = ((GameObject)Resources.Load("Phone Attacks/LazerBeam")).transform; phoneStunBullet = ((GameObject)Resources.Load("Phone Attacks/StunBullet")).transform; phoneStunExplosion = ((GameObject)Resources.Load("Phone Attacks/StunExplosion")).transform; phoneStunLight = ((GameObject)Resources.Load("Phone Attacks/StunLight")).transform; playerSprite = transform.FindChild("PlayerSprite"); flashLight = GetComponent <FlashlightControl>(); // Player Audio sources - location in array dependent upon order of player components // first audio source listed is source[0] aSources = GetComponents <AudioSource>(); footStepsAudio = aSources[0]; swordAudioChannel = aSources[1]; takingDamageAudio = aSources[2]; itemPickupAudio = aSources[3]; noBatteryAudio = aSources[4]; batteryChargingAudio = aSources[5]; swordAudioChannel.loop = false; takingDamageAudio.loop = false; itemPickupAudio.loop = false; curDirection = FacingDirection.Down; curAnim = transform.FindChild("PlayerSprite").GetComponent <tk2dSpriteAnimator>(); curHealth = maxHealth; curPhoneCharge = maxPhoneCharge; curStamina = 0; rightSideHitbox = GameObject.Find("RightSideAttackHitbox").GetComponent <PlayerAttackHitbox>(); leftSideHitbox = GameObject.Find("LeftSideAttackHitbox").GetComponent <PlayerAttackHitbox>(); upHitbox = GameObject.Find("UpAttackHitbox").GetComponent <PlayerAttackHitbox>(); downHitbox = GameObject.Find("DownAttackHitbox").GetComponent <PlayerAttackHitbox>(); invulnerable = false; } }
// Use this for initialization void Start() { if (initialInfoCard != null) { Camera.main.GetComponent<CameraControl>().pauseAndDrawInfoCard(initialInfoCard); } if (startInCutscene) { enterCutscene(); } else { // Loads Prefabs directly from Resources Folder phoneBullet = ((GameObject) Resources.Load("Phone Attacks/Bullet")).transform; phoneLazerBeam = ((GameObject) Resources.Load("Phone Attacks/LazerBeam")).transform; phoneStunBullet = ((GameObject) Resources.Load("Phone Attacks/StunBullet")).transform; phoneStunExplosion = ((GameObject) Resources.Load("Phone Attacks/StunExplosion")).transform; phoneStunLight = ((GameObject) Resources.Load("Phone Attacks/StunLight")).transform; playerSprite = transform.FindChild("PlayerSprite"); flashLight = GetComponent<FlashlightControl>(); // Player Audio sources - location in array dependent upon order of player components // first audio source listed is source[0] aSources = GetComponents<AudioSource>(); footStepsAudio = aSources[0]; swordAudioChannel = aSources[1]; takingDamageAudio = aSources[2]; itemPickupAudio = aSources[3]; noBatteryAudio = aSources[4]; batteryChargingAudio = aSources[5]; swordAudioChannel.loop = false; takingDamageAudio.loop = false; itemPickupAudio.loop = false; curDirection = FacingDirection.Down; curAnim = transform.FindChild("PlayerSprite").GetComponent<tk2dSpriteAnimator>(); curHealth = maxHealth; curPhoneCharge = maxPhoneCharge; curStamina = 0; rightSideHitbox = GameObject.Find("RightSideAttackHitbox").GetComponent<PlayerAttackHitbox>(); leftSideHitbox = GameObject.Find("LeftSideAttackHitbox").GetComponent<PlayerAttackHitbox>(); upHitbox = GameObject.Find("UpAttackHitbox").GetComponent<PlayerAttackHitbox>(); downHitbox = GameObject.Find("DownAttackHitbox").GetComponent<PlayerAttackHitbox>(); invulnerable = false; } }