point() public method

public point ( float ratio ) : Vector3
ratio float
return Vector3
Example #1
0
 static public int point(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         LTSpline      self = (LTSpline)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         var ret = self.point(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Example #2
0
    void Update()
    {
        ltLogo.transform.position = cr.point(iter /*(Time.time*1000)%1000 * 1.0 / 1000.0 */);

        iter += Time.deltaTime * 0.1f;
        if (iter > 1.0f)
        {
            iter = 0.0f;
        }
    }
    // Update is called once per frame
    void Update()
    {
        ltLogo.transform.position = s.point(iter);

        iter += Time.deltaTime * 0.1f;
        if (iter > 1f)
        {
            iter = 0f;
        }
    }
Example #4
0
    void Update()
    {
        // Iterating over path
        ltLogo.transform.position = spline.point(iter /*(Time.time*1000)%1000 * 1.0 / 1000.0 */);

        iter += Time.deltaTime * 0.1f;
        if (iter > 1.0f)
        {
            iter = 0.0f;
        }
    }
Example #5
0
 static public int point(IntPtr l)
 {
     try {
         LTSpline      self = (LTSpline)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         var ret = self.point(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #6
0
 static public int point(IntPtr l)
 {
     try {
         LTSpline      self = (LTSpline)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         var ret = self.point(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Example #7
0
 static int point(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         LTSpline            obj  = (LTSpline)ToLua.CheckObject(L, 1, typeof(LTSpline));
         float               arg0 = (float)LuaDLL.luaL_checknumber(L, 2);
         UnityEngine.Vector3 o    = obj.point(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #8
0
    private float CreateAttack(GameBoard board, SSlot slot, int pipeColor, int attackPower)
    {
        EnemySlot enemySlot = board.AEnemies.Slots[slot.X]; // find enemies slot in front of slot
        Enemy     enemy     = enemySlot.GetEnemy();

        if (!enemy)
        {
            board.BreakePipeInSlot(slot, (slot.Pipe as Pipe_Colored).GetExplodeEffectPrefab());
            OnEndAttack();
            return(0);
        }
        SPipe pipe = slot.TakePipe();

        //Time.timeScale = 0.1f;
        Vector3 fromPos = pipe.transform.position;
        Vector3 toPos   = enemySlot.transform.position;

        float distance = Mathf.Abs(fromPos.y - toPos.y);
        float speed    = 0.05f; // per unit
        float flyTime  = distance * speed;

        Vector3[] pathPoints = new Vector3[5];
        // from
        Vector3 p1 = fromPos;

        p1.z                    = -11;
        pathPoints[1]           = p1;
        pipe.transform.position = p1;
        // to
        Vector3 p3 = toPos;

        p3.z          = -11;
        pathPoints[3] = p3;
        // first liverage
        Vector3 p0 = p1;

        p0.x         += UnityEngine.Random.Range(-4.0f, 4.0f);
        p0.y         += UnityEngine.Random.Range(-2.0f, -4.0f);
        pathPoints[0] = p0;
        // second liverage
        Vector3 p4 = p3;

        p4.x         += UnityEngine.Random.Range(-4.0f, 4.0f);
        p4.y         += UnityEngine.Random.Range(2.0f, 4.0f);
        pathPoints[4] = p4;
        // middle point
        Vector3 p2 = (p1 + p3) / 2.0f;

        p2.x         += UnityEngine.Random.Range(-3.0f, 3.0f);
        pathPoints[2] = p2;
        //
        LTSpline spline = new LTSpline(pathPoints);
        //
        //GameObject trailEffect = GameObject.Instantiate(FlyEffectPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        //trailEffect.transform.SetParent(pipe.transform, false);
        //trailEffect.transform.localPosition = Vector3.zero;
        ////trailEffect.transform.position = fromPos;
        ////trailEffect.transform.localScale = new Vector3(0, 0, 1);
        ////LeanTween.scale(trailEffect, Vector3.one, Consts.FINAL_ATTACK_TIME / 2.0f)
        ////    .setEase(LeanTweenType.easeInOutSine)
        ////    .setLoopPingPong(1)
        Vector3 startAngle = pipe.transform.eulerAngles;

        LeanTween.value(pipe.gameObject, 0.0f, 1.0f, flyTime)
        .setOnUpdate((float norm) =>
        {
            Vector3 pos             = spline.point(norm);
            pipe.transform.position = pos;
        })
        .setOnComplete(() =>
        {
            ApplyAttack(board, enemy, pipeColor, attackPower);
            //Destroy(trailEffect, Consts.ADD_POINTS_EFFECT_TIME + 0.2f);
            pipe.transform.localScale = Vector3.one;
            pipe.transform.localScale = Vector3.zero;
            pipe.gameObject.SetActive(false);
            //pipe.PlayHideAnimation();
        })
        .setEaseInOutSine();
        LeanTween.rotateX(pipe.gameObject, startAngle.x + 40, (flyTime - 0.05f) / 2.0f)
        .setLoopPingPong(1)
        .setEase(LeanTweenType.easeInOutSine);
        LeanTween.rotateY(pipe.gameObject, startAngle.y + 40, (flyTime - 0.05f) / 2.0f)
        .setLoopPingPong(1)
        .setEase(LeanTweenType.easeInOutSine);
        float scale = 0.85f;

        LeanTween.scale(pipe.gameObject, new Vector3(scale, scale, scale), flyTime - 0.1f);
        return(flyTime);
    }
Example #9
0
    protected void FlyingEffect(SPipe pipe)
    {
        //Time.timeScale = 0.1f;
        int pipeColor = pipe.AColor;
        //pipe.PlayHideAnimation();
        Vector3 fromPos = pipe.transform.position;
        Vector3 toPos   = Slots[pipeColor].transform.position;

        Vector3[] pathPoints = new Vector3[5];
        // from
        Vector3 p1 = fromPos;

        p1.z                    = -11;
        pathPoints[1]           = p1;
        pipe.transform.position = p1;
        // to
        Vector3 p3 = toPos;

        p3.z          = -11;
        pathPoints[3] = p3;
        // first liverage
        Vector3 p0 = p1;

        p0.x         += UnityEngine.Random.Range(-4.0f, 4.0f);
        p0.y         += UnityEngine.Random.Range(-2.0f, -4.0f);
        pathPoints[0] = p0;
        // second liverage
        Vector3 p4 = p3;

        p4.x         += UnityEngine.Random.Range(-4.0f, 4.0f);
        p4.y         += UnityEngine.Random.Range(2.0f, 4.0f);
        pathPoints[4] = p4;
        // middle point
        Vector3 p2 = (p1 + p3) / 2.0f;

        p2.x         += UnityEngine.Random.Range(-3.0f, 3.0f);
        pathPoints[2] = p2;
        //
        LTSpline spline = new LTSpline(pathPoints);
        //
        //GameObject trailEffect = GameObject.Instantiate(FlyEffectPrefab, Vector3.zero, Quaternion.identity) as GameObject;
        //trailEffect.transform.SetParent(pipe.transform, false);
        //trailEffect.transform.localPosition = Vector3.zero;
        ////trailEffect.transform.position = fromPos;
        ////trailEffect.transform.localScale = new Vector3(0, 0, 1);
        ////LeanTween.scale(trailEffect, Vector3.one, Consts.ADD_POINTS_EFFECT_TIME / 2.0f)
        ////    .setEase(LeanTweenType.easeInOutSine)
        ////    .setLoopPingPong(1)
        Vector3 startAngle = pipe.transform.eulerAngles;

        LeanTween.value(pipe.gameObject, 0.0f, 1.0f, Consts.ADD_POINTS_EFFECT_TIME)
        .setOnUpdate((float norm) =>
        {
            Vector3 pos             = spline.point(norm);
            pipe.transform.position = pos;
        })
        .setOnComplete(() =>
        {
            //Destroy(trailEffect, Consts.ADD_POINTS_EFFECT_TIME + 0.2f);
            pipe.transform.localScale = Vector3.one;
            //pipe.PlayHideAnimation();
            pipe.gameObject.SetActive(false);
            pipe.transform.localScale = Vector3.zero;
            Slots[pipeColor].CheckMark.SetActive(true);
        })
        .setEaseInOutSine();
        LeanTween.rotateX(pipe.gameObject, startAngle.x + 40, (Consts.ADD_POINTS_EFFECT_TIME - 0.05f) / 2.0f)
        .setLoopPingPong(1)
        .setEase(LeanTweenType.easeInOutSine);
        LeanTween.rotateY(pipe.gameObject, startAngle.y + 40, (Consts.ADD_POINTS_EFFECT_TIME - 0.05f) / 2.0f)
        .setLoopPingPong(1)
        .setEase(LeanTweenType.easeInOutSine);
        float scale = 0.85f;

        LeanTween.scale(pipe.gameObject, new Vector3(scale, scale, scale), Consts.ADD_POINTS_EFFECT_TIME - 0.1f);
    }