Esempio n. 1
0
    public virtual void Move()
    {
        if (constant)
        {
            moveTime += speed * Time.deltaTime / Vector3.Distance(posOrigin.point, targetPos.point);
        }
        else
        {
            moveTime += targetPos.speed * Time.deltaTime;
        }

        tp.position = MathEx.GetEaseFormula(posOrigin, targetPos, moveTime, targetPos.type, origin);

        if (moveTime >= 1f)
        {
            if (lineCode >= pathInfo.lines.Count)
            {
                DisableEnemy();
                return;
            }

            tp.position = MathEx.GetEaseFormula(posOrigin, targetPos, 1f, pathInfo.lines[lineCode].type, origin);
            moveTime    = 0f;
            posOrigin   = targetPos;
            targetPos   = pathInfo.lines[lineCode++];

            stayTime = posOrigin.stayTime;
        }
    }
Esempio n. 2
0
    public void Movement()
    {
        if (constant)
        {
            time += speed * Time.deltaTime / Vector3.Distance(posOrigin.point, targetPos.point);
        }
        else
        {
            time += targetPos.speed * Time.deltaTime;
        }
        tp.position = MathEx.GetEaseFormula(posOrigin, targetPos, time, targetPos.type, spawnPos);
        //tp.position = Vector3.Lerp(posOrigin,targetPos,time);
        if (time >= 1f)
        {
            if (lineCode >= path.lines.Count)
            {
                tp.gameObject.SetActive(false);
                Test.instance.enemyCount--;
                return;
            }
            //tp.position = Vector3.Lerp(posOrigin,targetPos,1);
            tp.position = MathEx.GetEaseFormula(posOrigin, targetPos, 1, path.lines[lineCode].type, spawnPos);
            time        = 0f;
            posOrigin   = targetPos;
            targetPos   = path.lines[lineCode++];

            stayTime = posOrigin.stayTime;
        }
    }
Esempio n. 3
0
    public void AddLineInfoMarker(PathDatabase.LineInfo info)
    {
        LineInfoMarker marker = Instantiate(lineInfoMarkerBase).GetComponent <LineInfoMarker>();

        marker.transform.SetParent(this.transform);
        marker.Set(info);

        lineinfoMarkerList.Add(marker);
    }
Esempio n. 4
0
    public void Set(PathDatabase.LineInfo i, int b)
    {
        info               = i;
        bezierPoint        = b;
        transform.position = info.bezierPoint[bezierPoint];

        gameObject.SetActive(info.type == MathEx.EaseType.BezierCurve);
        ColorSet();
    }
Esempio n. 5
0
    public void CreatePosMarker(PathDatabase.LineInfo info, PointMarker.MarkerType type, int code = -1)
    {
        PointMarker pt = Instantiate(posMarker, Vector3.zero, Quaternion.identity).GetComponent <PointMarker>();

        pt.Set(info, type, code);

        pt.transform.SetParent(parent);

        ptList.Add(pt);
    }
Esempio n. 6
0
    public void CreateNewLineInfo(Vector3 pos)
    {
        if (pathDatabase.data[pathListUI.value].lineCode == -1)
        {
            pathDatabase.data[pathListUI.value].startPoint.point = pos;
            AddLineInfoMarker(pathDatabase.data[pathListUI.value].startPoint);
            ++pathDatabase.data[pathListUI.value].lineCode;
        }
        else
        {
            PathDatabase.LineInfo info = new PathDatabase.LineInfo(pos);
            pathDatabase.data[pathListUI.value].lines.Add(info);

            AddLineInfoMarker(info);
        }

        LineRendererSync();
    }
Esempio n. 7
0
    public void SetUp(PathDatabase.PathInfo p)
    {
        if (p.lines.Count == 0)
        {
            return;
        }
        path     = p;
        lineCode = 0;
        time     = 0f;
        speed    = path.speed;
        constant = path.constantSpeed;

        tp.position = path.startPoint.point;
        posOrigin   = path.startPoint;
        targetPos   = path.lines[lineCode++];

        tp.gameObject.SetActive(true);
    }
Esempio n. 8
0
    public void Set(PathDatabase.LineInfo l, MarkerType type, int code = -1)
    {
        line       = l;
        markerType = type;

        if (type == MarkerType.LinePointer)
        {
            transform.position = line.point;
        }
        else if (type == MarkerType.BezierPointer)
        {
            transform.position = line.bezierPoint[code];
            bezierCode         = code;
            SetLine();
        }

        SetColor();
    }
Esempio n. 9
0
    public void Update()
    {
        if (stayTime != 0f)
        {
            stayTime -= Time.deltaTime;
            if (stayTime <= 0f)
            {
                stayTime = 0f;
            }
        }
        else
        {
            if (constant)
            {
                time += speed * Time.deltaTime / Vector3.Distance(posOrigin.point, targetPos.point);
            }
            else
            {
                time += targetPos.speed * Time.deltaTime;
            }
            tp.position = MathEx.GetEaseFormula(posOrigin, targetPos, time, targetPos.type);

            //tp.position = Vector3.Lerp(posOrigin,targetPos,time);
            if (time >= 1f)
            {
                if (lineCode >= path.lines.Count)
                {
                    tp.gameObject.SetActive(false);
                    return;
                }
                //tp.position = Vector3.Lerp(posOrigin,targetPos,1);

                tp.position = MathEx.GetEaseFormula(posOrigin, targetPos, 1, path.lines[lineCode].type);
                time        = 0f;
                posOrigin   = targetPos;
                targetPos   = path.lines[lineCode++];

                stayTime = posOrigin.stayTime;
            }
        }
    }
Esempio n. 10
0
    public void InitValues()
    {
        speed    = pathInfo.speed;
        constant = pathInfo.constantSpeed;
        stayTime = pathInfo.startPoint.stayTime;

        SetMaxHp(enemyInfo.hp);
        SetDead(false);

        moveTime = 0f;
        lineCode = 0;

        patternRate = enemyInfo.patternRate;
        patternTime = 0f;

        fireRate = 1f / enemyInfo.fps;
        fire     = 0f;

        tp.position = pathInfo.startPoint.point;
        posOrigin   = pathInfo.startPoint;
        targetPos   = pathInfo.lines[lineCode++];
    }
Esempio n. 11
0
    public void Init(float ptr, float sp, bool con, Vector3 spawn, Sprite sprite, EnemyDatabase.BulletFrameInfo[] bt, PathDatabase.PathInfo p, Vector2[] shotpt)
    {
        spriteRenderer.sprite = sprite;
        patternRate           = ptr;
        //point = pt;
        path = p;

        spawnPos = spawn;

        speed    = sp;
        constant = con;

        stayTime = path.startPoint.stayTime;

        fireRate = 1f / 12f;

        bullet     = bt;
        shotPoints = shotpt;

        posOrigin = path.startPoint;
        targetPos = path.lines[lineCode++];
    }
Esempio n. 12
0
    public static Vector2 GetEaseFormula(PathDatabase.LineInfo start, PathDatabase.LineInfo end, float time, EaseType type, Vector2 spawn = new Vector2())
    {
        if (type == EaseType.Linear)
        {
            return(LinearVector2(start.point + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.BezierCurve)
        {
            return(GetPointOnBezierCurve(start.point + spawn, start.bezierPoint[1] + spawn, end.bezierPoint[0] + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.EaseInQuad)
        {
            return(EaseInQuadVector2(start.point + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.EaseOutQuad)
        {
            return(EaseOutQuadVector2(start.point + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.EaseInOutQuad)
        {
            return(EaseInOutQuadVector2(start.point + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.EaseInCubic)
        {
            return(EaseInCubicVector2(start.point + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.EaseOutCubic)
        {
            return(EaseOutCubicVector2(start.point + spawn, end.point + spawn, time));
        }
        else if (type == EaseType.EaseInOutCubic)
        {
            return(EaseInOutCubicVector2(start.point + spawn, end.point + spawn, time));
        }

        return(new Vector2());
    }
Esempio n. 13
0
    public void SetUp(PathDatabase.LineInfo l)
    {
        EnableAllUI();

        if (line != null)
        {
            if (line.type != l.type)
            {
                setUpCheck = true;
            }
            else
            {
                setUpCheck = false;
            }
        }

        line = l;

        //type.text = "타입 : " + line.type.ToString();

        ValueUpdate();

        movementType.value = (int)line.type;
    }
Esempio n. 14
0
 public void Set(PathDatabase.LineInfo i)
 {
     info = i;
     transform.position = info.point;
 }
Esempio n. 15
0
 public void UpdatePointUI(PathDatabase.LineInfo l)
 {
     pointInfoUi.SetUp(l);
 }