示例#1
0
    /// <summary>
    /// Excecuted when asteroid is reactivated. It will set all values to the desired valued
    /// </summary>
    public void OnActivate(float size, Vector3 startPos, float direction, float speed)
    {
        Size = size;

        ThisAsteroid.transform.position   = startPos;
        ThisAsteroid.transform.localScale = new Vector3(size, size);
        _boxCollider2D.size = new Vector2(Size, Size);

        _movementDirection = new Vector3(Mathf.Cos(direction) * speed, Mathf.Sin(direction) * speed);
        ThisAsteroid.SetActive(true);
    }
示例#2
0
 /// <summary>
 /// Done when Asteroid is deactivated. Right now only disables the object
 /// </summary>
 public void OnDisable()
 {
     ThisAsteroid.SetActive(false);
 }