예제 #1
0
    // Use this for initialization
    void Start()
    {
        if (target == null)
        {
            target = Object.FindObjectOfType <PlayerMouseController>().transform;
        }

        slider = GetComponent <SphereSurfaceSlider>();
    }
예제 #2
0
    public void HitStorm(Puck puck)
    {
        SphereSurfaceSlider otherSlider = puck.GetComponent <SphereSurfaceSlider>();

        if (otherSlider && puck)
        {
            otherSlider.HitByStormWithSphericalVelocity(0.5f * slider.sphericalVelocity);
            GameObject.Destroy(gameObject);
        }
    }
예제 #3
0
    void OnCollisionEnter(Collision collision)
    {
        Puck puck = collision.collider.GetComponent <Puck>();
        SphereSurfaceSlider otherSlider = collision.collider.GetComponent <SphereSurfaceSlider>();

        if (otherSlider && puck)
        {
            otherSlider.HitByStormWithSphericalVelocity(slider.sphericalVelocity);
            GameObject.Destroy(gameObject);
        }
    }
예제 #4
0
    void SpawnWorldObj(GameObject prefab, float minSpeed, float maxSpeed)
    {
        // Choose a random location
        Vector3 spawnLocation     = Random.onUnitSphere;
        Vector3 rightAngleVector  = spawnLocation == Vector3.up ? Vector3.right : Vector3.up;
        Vector3 movementDirection = Vector3.Cross(spawnLocation, rightAngleVector);
        Vector3 movementVector    = Quaternion.AngleAxis(Random.Range(0f, 360f), spawnLocation) * movementDirection;

        GameObject          spawnedObject = (GameObject)GameObject.Instantiate(prefab, spawnLocation * 50f, Quaternion.LookRotation(movementDirection, spawnLocation));
        SphereSurfaceSlider slider        = spawnedObject.GetComponent <SphereSurfaceSlider>();

        slider.sphericalVelocity = Random.Range(minSpeed, maxSpeed) * movementVector;
    }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     slider = GetComponent <SphereSurfaceSlider>();
     turnRateChangeCyclePosition = Random.value;
 }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     slider = GetComponent <SphereSurfaceSlider>();
 }