예제 #1
0
    public void Reset()
    {
        if (movement)
        {
            movement.ClearTargets();
        }
        if (path)
        {
            path.UpdateTarget();
        }
        DroneContainer d = GetComponentInChildren <DroneContainer> ();

        if (d)
        {
            d.ReReposition();
        }
    }
예제 #2
0
    /// <summary>
    /// Raises the touch event.
    /// </summary>
    /// <param name="position">Position.</param>
    public override void OnTap(Vector3 position)
    {
        lastPosition = position;

        // Find the first object under the touch position
        RaycastHit2D hit = Physics2D.Raycast(position, Vector3.forward, Mathf.Infinity, layerMask);

        if (hit.collider && ((hit.collider.gameObject.tag == "Spaceship") || (hit.collider.gameObject.tag == "Satellite")) && (!Global.paused))
        {
            if (tapTimer < 0f)
            {
                if (hit.collider.gameObject != selection)
                {
                    Select(hit.collider.gameObject);
                }
                tapTimer = tapTime;
            }
            else if (hit.collider.gameObject == selection)
            {
                OnDoubleTap(position);
                tapTimer = -1f;
            }
        }
        else if ((movement) && (movement.gameObject.tag == "Spaceship") && (!Global.paused))
        {
            // movement variable still set from a previous touch
            if (resetOnNext)
            {
                movement.ClearTargets();
                resetOnNext = false;
            }
            movement.AddTarget(new Vector3(position.x, position.y, 0f));
            MotionPath path = movement.gameObject.GetComponentInChildren <MotionPath> ();
            if (path)
            {
                path.UpdateTarget();
            }
        }
    }