Beispiel #1
0
    public virtual void OnClicked(Vector3 pos, Vector3 forward)
    {
        //Set Status
        _logic = LOGIC.Clicked;

        if (_state != STATE.Generalize)
        {
            return;
        }

        //Set Grouping Status
        if (_group != GROUP.Done)
        {
            _group = GROUP.Ready;
        }

        _currentPosition = transform.position;
        _targetPosition  = pos;

        _currentLooker = transform.position + transform.forward;
        _targetLooker  = pos + forward;

        _updateLogic  = null;
        _updateLogic += UpdateGrapedLogic;

        _boxCollider.size      = _boxColliderSizeDraged;
        _boxCollider.center    = _boxColliderCenterDraged;
        _boxCollider.isTrigger = true;
    }
Beispiel #2
0
    protected virtual void Awake()
    {
        //SetStates
        _logic = LOGIC.Default;
        _group = GROUP.None;
        _state = STATE.Generalize;

        //Load Resources
        _prefabGroup = Resources.Load("Prefabs/Group") as GameObject;

        //init objects
        _listCollidedSWindows = new List <SWindow>();
        _ray         = new Ray();
        _rayPosition = Vector3.zero;
        _parent      = transform.parent;

        //Position &  Looker Init
        _updateLogic  = null;
        _updateLogic += UpdateDefaultLogic;

        _updateGrouping = UpdateCheckingGrouping;

        _currentScale    = _targetScale = transform.localScale;
        _currentPosition = _targetPosition = transform.position;
        _currentLooker   = _targetLooker = transform.position + transform.forward;

        //added components
        InitComponent <Rigidbody>(InitRigidBody);
        InitComponent <BoxCollider>(InitBoxCollider);
    }
Beispiel #3
0
    public virtual void OnDraged(Vector3 pos, Vector3 forward)
    {
        //Set Status
        _logic = LOGIC.Grabed;

        if (_state != STATE.Generalize)
        {
            return;
        }

        //Set Transform
        _targetPosition = pos;
        _targetLooker   = pos + forward;

        //Debugging
        Debug.DrawLine(_ray.origin, _ray.origin + _ray.direction, Color.cyan);
    }
Beispiel #4
0
    public virtual void OnReleased(Vector3 pos, Vector3 forward)
    {
        //Set Status
        _logic = LOGIC.Released;

        if (_state != STATE.Generalize)
        {
            return;
        }

        //Set Grouping Status
        if (_group != GROUP.Done)
        {
            _group = GROUP.None;
        }

        //Set Transform
        _targetPosition = pos;
        _targetLooker   = transform.position + transform.forward;

        //Clear CollidedWindows List
        _listCollidedSWindows.Clear();


        if (_group == GROUP.Done)
        {
            _updateLogic  = null;
            _updateLogic += UpdateGroupingLogic;
        }
        else
        {
            _updateLogic  = null;
            _updateLogic += UpdateDefaultLogic;
        }

        _boxCollider.size      = _boxColliderSizeReleased;
        _boxCollider.center    = _boxColliderCenterReleased;
        _boxCollider.isTrigger = false;
    }