Пример #1
0
    public override EM_SpawnLocationData GetSpawnLocation(SE_SkillObject skillObj)
    {
        updateParamsChanged();

        var data = new EM_SpawnLocationData();

        baseLocation = transform.position - transform.right * (length / 2);

        baseLocation += transform.right * (getPositionRatioByLocationMode(skillObj) * length);

        float spanAngle = -Mathf.PI * 2f * angle / 360;

        Vector3 dir = TransformUtility.Get3DCirclePoint(spanAngle, 1, Vector3.zero, -transform.right, transform.up);

        data.Location = baseLocation;
        data.Foward   = dir;


        debugLine.Enqueue(data);
        if (debugLine.Count > 10)
        {
            debugLine.Dequeue();
        }
        return(data);
    }
Пример #2
0
    public override EM_SpawnLocationData GetSpawnLocation(SE_SkillObject skillObj)
    {
        updateParamsChanged();

        var   data      = new EM_SpawnLocationData();
        float spanAngle = -(arcOffset / 360) * (Mathf.PI * 2f);

        spanAngle -= getSpanAngleByLocationMode(skillObj);

        Vector3 a            = transform.up;
        float   radiusByType = radius - (radiusThickness) * radius * Random.value;

        //zero radius cannot generate correct rotation
        if (radiusByType == 0)
        {
            radiusByType = 0.001f;
        }
        spanAngle   *= bReverseDirection ? -1 : 1;
        baseLocation = TransformUtility.Get3DCirclePoint(spanAngle, radiusByType, transform.position, a, transform.right);

        data.Location = baseLocation;
        data.Foward   = (baseLocation - transform.position).normalized;


        debugLine.Enqueue(data);
        if (debugLine.Count > 10)
        {
            debugLine.Dequeue();
        }
        return(data);
    }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        initAnchorOffset = GetInitAnchorOffset != null?GetInitAnchorOffset() : Vector3.zero;

        skillInstance.localPosition = initAnchorOffset;
        skillInstance.localRotation = new Quaternion();

        target = GetSkillTarget != null?GetSkillTarget() : null;

        spawnLocationData = GetSpawnLocationData != null?GetSpawnLocationData(this) : null;

        if (spawnLocationData != null)
        {
            transform.position = spawnLocationData.Location;
            transform.forward  = spawnLocationData.Foward;
            velocityDir        = transform.localRotation;
        }
        else
        {
            transform.position = emitter.transform.position;
            transform.forward  = emitter.transform.forward;
            velocityDir        = emitter.transform.rotation;
        }
        initLifetime = GetInitLifetime != null?GetInitLifetime() : 1;

        lifetimeRemain = initLifetime;
        initSize       = GetInitSize != null?GetInitSize() : Vector3.one;

        transform.localScale = initSize;
        initRotation         = GetInitRotation != null?GetInitRotation() : Vector3.zero;

        initRotRate = GetInitRotationRate != null?GetInitRotationRate() : Vector3.zero;

        initAnchorRotRate = GetInitAnchorRotationRate != null?GetInitAnchorRotationRate() : Vector3.zero;

        skillInstance.localRotation = Quaternion.Euler(initRotation);
        initVelocity = GetInitVelocity != null?GetInitVelocity() : Vector3.zero;

        velocity = velocityDir * (spawnLocationData != null ? initVelocity : initVelocity);

        if (OnCollisionReceiver != null)
        {
            var collisionListener = skillInstance.gameObject.AddComponent <CollisionListener>();
            collisionListener.skillObj       = this;
            collisionListener.OnCollisionDel = OnCollisionReceiver;
        }
        if (OnInitDone != null)
        {
            OnInitDone(this);
        }
        UpdateModifierOverTime(0);
    }
Пример #4
0
    public override EM_SpawnLocationData GetSpawnLocation(SE_SkillObject skillObj)
    {
        updateParamsChanged();

        var data = new EM_SpawnLocationData();

        float spanAngle = -Mathf.PI * 2f;

        spanAngle -= getSpanAngleByLocationMode(skillObj);

        Vector3 a                 = transform.forward;
        float   radiusByType      = getRadiusByEmitType();
        float   lengthRatioByType = getLengthRatioByEmitType();

        coneBaseLocation = TransformUtility.Get3DCirclePoint(spanAngle, radiusByType, transform.position, a, transform.right);
        coneTopLocation  = TransformUtility.Get3DCirclePoint(spanAngle, coneTopRadius * radiusByType / radius, transform.position + a * length, a, transform.right);
        coneTopLocation += topOffset;

        if (!bReverseEmitBase)
        {
            data.Location = coneBaseLocation + (coneTopLocation - coneBaseLocation) * lengthRatioByType;
            data.Foward   = (coneTopLocation - coneBaseLocation).normalized;
        }
        else
        {
            data.Location = coneBaseLocation + (coneTopLocation - coneBaseLocation) * (1 - lengthRatioByType);
            data.Foward   = (coneBaseLocation - coneTopLocation).normalized;
        }

        debugLine.Enqueue(data);
        if (debugLine.Count > 10)
        {
            debugLine.Dequeue();
        }
        return(data);
    }