void OnTriggerStay(Collider other) { if (state == 1) { SquidController squid = other.GetComponent <SquidController>(); if ((squid != null) && (squid.getPowerupPhase() == 0)) { follow = squid.gameObject; squid.givePowerup(); state = 0; cooldownStart = Time.time; fxBurst.Play(); if (squid.playerIndex == 0) { sound.PlayOneShot(redSound); } else { sound.PlayOneShot(blueSound); } } } }
IEnumerator CreateInvaders() { for (int i = 0; i < 5; i++) { for (int j = 0; j < 11; j++) { Vector3 birthPosition = new Vector3(-2.4f + j * 0.4f, 0.45f * i, 0); if (i < 2) { GameObject obj = Instantiate(bee, birthPosition, Quaternion.identity) as GameObject; BeeController controller = obj.GetComponent <BeeController>(); controller.invaderId = i * 5 + j; InvaderPlatoon.Add(controller); } else if (i < 4) { GameObject obj = Instantiate(squid, birthPosition, Quaternion.identity) as GameObject; SquidController controller = obj.GetComponent <SquidController>(); controller.invaderId = i * 5 + j; InvaderPlatoon.Add(controller); } else { GameObject obj = Instantiate(octopus, birthPosition, Quaternion.identity) as GameObject; OctopusController controller = obj.GetComponent <OctopusController>(); controller.invaderId = i * 5 + j; InvaderPlatoon.Add(controller); } yield return(new WaitForSeconds(0.01f)); } } movementState = MovementState.RIGHT; yield return(null); finishCreated = true; }
void Awake() { source = GetComponent<AudioSource>(); squid = transform.parent.gameObject.GetComponent<SquidController>(); }
void Awake() { source = GetComponent <AudioSource>(); squid = transform.parent.gameObject.GetComponent <SquidController>(); }
private void Awake() { State = CannonState.Empty; _squidController = FindObjectOfType <SquidController>(); }
void Awake() { squid = squidShip.GetComponent<SquidController>(); panelTransform = GetComponent<RectTransform>(); panelImage = transform.GetChild(0).GetComponent<Image>(); }
void Awake() { squid = squidShip.GetComponent <SquidController>(); panelTransform = GetComponent <RectTransform>(); panelImage = transform.GetChild(0).GetComponent <Image>(); }
// Start is called before the first frame update void Start() { _controller = GetComponent <SquidController>(); lR = GetComponent <LineRenderer>(); lR.widthCurve = widthCurve; }