public Universal_Remote_Turntable(Twins ts, MutilatorDefAtLast mdl, TradFoolsEP tfep, Innocent inno, PopSong ps) { m_ts = ts; m_mdl = mdl; m_tfep = tfep; m_inno = inno; m_ps = ps; }
void OnTriggerExit(Collider col) { if (Innocent == null) { return; } var innocent = col.gameObject.GetComponent<Innocent>(); if (Innocent != null && Innocent == innocent) { PlayerCharacter.Instance.Rope.ResetColor(); Innocent = null; } }
void OnTriggerEnter(Collider col) { if (Innocent != null) { return; } Innocent = col.gameObject.GetComponent<Innocent>(); if (Innocent != null && !Innocent.Linked) { PlayerCharacter.Instance.Rope.UpdateColor(Innocent.MeshRenderer.material.color); } else { Innocent = null; } }
IEnumerator SpawnChainEffect(Innocent innocent) { Vector3 dir = (innocent.transform.position - transform.position).normalized; float distance = Vector3.Distance(transform.position, innocent.transform.position); float spawnedDistance = ChainFormationEffectInterval; Vector3 spawnPos = transform.position + (dir * ChainFormationEffectInterval); while (spawnedDistance < distance) { GameObject effect = Instantiate(ChainFormationParticle, spawnPos, Quaternion.identity) as GameObject; effect.GetComponent<ParticleSystem>().startColor = MeshRenderer.material.color; effect.GetComponent<ParticleSystem>().Play(); Destroy(effect, 3.0f); spawnedDistance += ChainFormationEffectInterval; spawnPos += (dir * ChainFormationEffectInterval); yield return new WaitForSeconds(Time.deltaTime); } }
public void LinkNewChain(Innocent innocent) { if (innocent.Linked) { return; } CurrentLinkedNumber++; innocent.Linked = true; innocent.SpeedMax = 80f; innocent.SpeedMax = 100f; innocent.ChangeSpeedAndDirection(); AudioSource.PlayClipAtPoint(LinkForm, Camera.main.transform.position); //LineRenderer lineRenderer = innocent.gameObject.AddComponent<LineRenderer>(); Chains.Add(new Chain() { Innocent = innocent, //LineRenderer = lineRenderer }); SpringJoint spring = innocent.gameObject.AddComponent<SpringJoint>(); spring.connectedBody = Rigidbody; //lineRenderer.material = Rope.LineRenderer.material; //lineRenderer.SetWidth(0.05f, 0.05f); UpdateNewColor(innocent.MeshRenderer.material.color); Vector3 dir = (innocent.transform.position - transform.position).normalized; float distance = Vector3.Distance(transform.position, innocent.transform.position); Vector3 spawnPos = transform.position + (dir * (distance - 1f)); GameObject effect = Instantiate(ChainFormationParticle, spawnPos, Quaternion.identity) as GameObject; effect.transform.SetParent(transform); effect.GetComponent<ParticleSystem>().startColor = new Color(MeshRenderer.material.color.r, MeshRenderer.material.color.g, MeshRenderer.material.color.b, 0.6f); effect.GetComponent<ParticleSystem>().Play(); Destroy(effect, 3.0f); if (CurrentLinkedNumber == NextEnlargeThreshold) { ShakeAudioSource.Play(); } }