Пример #1
0
    public void InitPattern(int id)
    {
        this.id          = id;
        transform.parent = null;
        float RandomCubric = 3;
        float Radius1 = Random.Range(7f, 12f), Radius2 = Random.Range(7f, 16f);
        float theta    = Random.Range(-45f, 225f) * Mathf.Deg2Rad;
        float distance = 0f;

        targetPlace  = k514SystemManager.InteractMgr.GetCrossHairTargetTransform();
        targetVector = (targetPlace == null) ? transform.position + Vector3.forward * 30f : targetPlace.position;
        // randomize
        targetVector += new Vector3(Random.Range(-RandomCubric, RandomCubric), Random.Range(-2, 2), Random.Range(-RandomCubric, RandomCubric + 2));

        // get distance
        distance = (transform.position - targetVector).magnitude;

        // add patterns

        List <k514EnemyBehaviour> tmp;
        k514PatternedShot         tmp3 = null;
        k514WaitSec    tmp4            = null;
        k514MoveDirect tmp5            = null;
        Vector3        here            = k514SystemManager.InteractMgr.GetPlayerVector();

        float sin = Mathf.Sin(theta), cos = Mathf.Cos(theta);

        k514MoveBezier tmp2 = (k514MoveBezier)k514EnemyPatternFactory.CreatePattern <k514MoveBezier>(this);

        tmp2.Init(this, here, here + new Vector3(Radius1 * cos, Radius1 * sin, distance * 0.1f), here + new Vector3(Radius2 * cos, Radius2 * sin, distance * 0.66f), targetVector);

        // set Speed
        tmp2.SetSpeed(1000f);
        tmp2.SetLifeSpanCnt(20);
        tmp2.SetMoveTime(0.005f);

        patterns.Add(tmp2);

        ActivateTrig = true;
    }