private void Start() { _deltaY = Screen.height; _sine = gameName.GetComponent <SineMovement>(); print("Start!"); StartMovement(); }
//constructor /// <summary> /// VerticalSinusoalMovement, constuctor /// </summary> /// <param name="minY">Min Y Value</param> /// <param name="maxY">Max Y Value</param> /// <param name="y">Inital Y Value</param> /// <param name="deltaX">Delta X</param> /// <param name="period">Period (In Ticks)</param> public HorizontalSinusodalMovement(double minY, double maxY, double y, double period, double deltaX) : base(deltaX, 0.0) { double amplitude = (maxY - minY) / 2; double offset = maxY - amplitude; double phase = Math.Asin((offset - y) / amplitude) + (2 * Math.PI); double altered = 0.2 * Math.PI / period; _sineMovement = new SineMovement(amplitude, altered, phase, offset); }
//constructor /// <summary> /// VerticalSinusoalMovement, constuctor /// </summary> /// <param name="minX">Min X Value</param> /// <param name="maxX">Max X Value</param> /// <param name="x">Inital X Value</param> /// <param name="deltaY">Delta Y</param> /// <param name="period">Period (In Ticks)</param> public VerticalSinusodalMovement(double minX, double maxX, double x, double period, double deltaY) : base(0.0, deltaY) { double amplitude = (maxX - minX) / 2; double offset = maxX - amplitude; double phase = Math.Asin((offset - x) / amplitude) + (2 * Math.PI); double altered = 0.2 * Math.PI / period; //double phase = (Math.Asin((offset - x) / amp) + 2 * Math.PI) / period; _sineMovement = new SineMovement(amplitude, altered, phase, offset); }
void Kill() { SineMovement sm = GetComponent <SineMovement>(); if (sm != null) { sm.enabled = false; } StraightMovement strm = GetComponent <StraightMovement>(); if (strm != null) { strm.enabled = false; } FollowObject fo = GetComponent <FollowObject>(); if (fo != null) { fo.enabled = false; } CircularMovement cm = GetComponent <CircularMovement>(); if (cm != null) { cm.enabled = false; } //Disable the renderer and the Collider GetComponent <SpriteRenderer>().enabled = false; GetComponent <Collider2D>().enabled = false; if (m_particle != null) { m_particle = ObjectPool.Instantiate(m_particle, transform.position, transform.rotation); StartCoroutine(KillAnimation()); } else { ObjectPool.Kill(gameObject); } }
/*IEnumerator DamagedAnimation() { * for (float f = 0; f <= 1; f += 0.2f) { * m_renderer.color = new Color(215f / 255 * f, 63f / 255 * f, 63f / 255 * f); * Debug.Log("CHANGE: " + m_renderer.color.r + ", " + m_renderer.color.g + ", " + m_renderer.color.b); * yield return new WaitForSeconds(0.1f); * } * * for (float f = 1; f >= 0; f -= 0.2f) { * m_renderer.color = new Color(215f / 255 * f, 63f / 255 * f, 63f / 255 * f); * Debug.Log("CHANGE BACK: " + m_renderer.color.r + ", " + m_renderer.color.g + ", " + m_renderer.color.b); * yield return new WaitForSeconds(0.1f); * } * }*/ void Kill() { SineMovement sm = GetComponent <SineMovement>(); if (sm != null) { sm.enabled = false; } StraightMovement strm = GetComponent <StraightMovement>(); if (strm != null) { strm.enabled = false; } FollowObject fo = GetComponent <FollowObject>(); if (fo != null) { fo.enabled = false; } CircularMovement cm = GetComponent <CircularMovement>(); if (cm != null) { cm.enabled = false; } //Disable the renderer and the Collider GetComponent <SpriteRenderer>().enabled = false; GetComponent <Collider2D>().enabled = false; m_particle.Play(); StartCoroutine(KillAnimation()); }
// Start is called before the first frame update void Start() { theRB2D = transform.parent.GetComponent <Rigidbody2D>(); theMove = FindObjectOfType <SineMovement>(); theBoss = FindObjectOfType <BossController>(); }
void Awake() { player = FindObjectOfType <Player> (); homingMovement = GetComponent <HomingMovement> (); baseMovement = GetComponent <SineMovement> (); }