Exemple #1
0
 public void setting(Vector3 target, float speed, IU3dActionCompleted monitor)
 {
     this.target  = target;
     this.speed   = speed;
     this.monitor = monitor;
     GameSceneController.GetInstance().setMoving(true);
 }
    //        initialAngle in Radial
    public void setting(Vector3 _startPoint, Vector3 _finishPoint, float _initialAngle, float _speed, IU3dActionCompleted _monitor)
    {
        this.startPoint = _startPoint;

        this.finishPoint = _finishPoint;

        this.initialAngle = _initialAngle;

        this.forceStrength = _speed;

        this.monitor = _monitor;

        Vector3 force = Vector3.Slerp(Vector3.Normalize(finishPoint - startPoint), Vector3.up, initialAngle);

        Debug.Log(force + " " + forceStrength);

        this.gameObject.GetComponent <Rigidbody>().AddForce(force * forceStrength, ForceMode.Impulse);
    }
Exemple #3
0
        public void setting(GameObject obj, Vector3 target, float speed, IU3dActionCompleted monitor)
        {
            this.obj     = obj;
            this.target  = target;
            this.speed   = speed;
            this.monitor = monitor;
            GameSceneController.GetInstance().setMoving(true);

            /* If obj is higher than target, move to target.z first, then move to target.y
             * If obj is lower than target, move to target.y first, then move to target.z
             */
            if (target.y < obj.transform.position.y)
            {
                Vector3 targetZ = new Vector3(target.x, obj.transform.position.y, target.z);
                ActionManager.GetInstance().ApplyMoveToAction(obj, targetZ, speed, this);
            }
            else
            {
                Vector3 targetY = new Vector3(target.x, target.y, obj.transform.position.z);
                ActionManager.GetInstance().ApplyMoveToAction(obj, targetY, speed, this);
            }
        }
Exemple #4
0
        // ApplyMoveToYZAction
        public U3dAction ApplyMoveToYZAction(GameObject obj, Vector3 target, float speed, IU3dActionCompleted completed)
        {
            MoveToYZAction ac = obj.AddComponent <MoveToYZAction> ();

            ac.setting(obj, target, speed, completed);
            return(ac);
        }
    public U3dAction applyU3dTossUFO(GameObject obj, Vector3 _startPoint, Vector3 _finishPoint, float _initialAngle, float _speed, IU3dActionCompleted _completed)
    {
        U3dTossUFO UTU = obj.AddComponent <U3dTossUFO> ();

        UTU.setting(_startPoint, _finishPoint, _initialAngle, _speed, _completed);
        return(UTU);
    }