예제 #1
0
    public PhysicalEffect SpawnAnchoredGroundEffect(int id, Rigidbody anchor, Vector3 direction = new Vector3(), float offset = 0f, float elevation = 0f)
    {
        GameObject     effectObject = Instantiate(effectPrefab, anchor.position, Quaternion.Euler(Vector3.zero));
        PhysicalEffect effect       = effectObject.GetComponent <PhysicalEffect>();

        effect.SetAnchor(anchor, direction, offset, elevation);
        effect.SetID(id);
        return(effect);
    }
예제 #2
0
파일: Effect.cs 프로젝트: nixjoe/starpoint
 public PhysicalEffect(PhysicalEffect copySource) : base(copySource)
 {
     xPos         = copySource.xPos;
     yPos         = copySource.yPos;
     zPos         = copySource.zPos;
     xValue       = copySource.xValue;
     yValue       = copySource.yValue;
     zValue       = copySource.zValue;
     physicalType = copySource.physicalType;
 }
예제 #3
0
    public override string StartState()
    {
        myController.characterAnimator.Play("Stun", -1, 0f);
        myController.SetSpriteMat("Flash");
        flashTime = startFlashTime;
        PhysicalEffect effect = EffectSpawner.instance.SpawnHitEffect(myController.rigidBody.position, 4f, Color.white);

        effect.SetAnchor(myController.rigidBody, effect.direction, 0f, 0.5f);
        return(stateName);
    }
예제 #4
0
    public PhysicalEffect SpawnGroundEffectDirected(int id, float scale = 4, Vector3 position = new Vector3(), Vector3 direction = new Vector3())
    {
        GameObject     effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero));
        PhysicalEffect effect       = effectObject.GetComponent <PhysicalEffect>();

        effect.SetID(id);
        effect.ScaleEffect(scale);
        Animator animator = effectObject.GetComponent <Animator>();

        animator.SetFloat("Horizontal", direction.x);
        animator.SetFloat("Vertical", direction.y);
        return(effect);
    }
예제 #5
0
    public PhysicalEffect SpawnFGEffect(int id, Vector3 position, float scale, Vector3 direction, Color fillColor = new Color())
    {
        GameObject     effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero));
        PhysicalEffect effect       = effectObject.GetComponent <PhysicalEffect>();

        effect.ScaleEffect(scale);
        effect.SetID(id);
        effect.direction = direction;

        SpriteRenderer effectSprite = effectObject.GetComponent <SpriteRenderer>();

        effectSprite.color = fillColor;
        return(effect);
    }
예제 #6
0
    public PhysicalEffect SpawnFGEffect(int id, Vector3 position, float scale, Vector3 direction, Color fillColor = new Color(), Color outlineColor = new Color())
    {
        GameObject     effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero));
        PhysicalEffect effect       = effectObject.GetComponent <PhysicalEffect>();

        effect.ScaleEffect(scale);
        effect.SetID(id);
        effect.direction = direction;

        SpriteRenderer effectSprite = effectObject.GetComponent <SpriteRenderer>();

        effectSprite.material = Resources.Load("Materials/OutlineAlways") as Material;
        effectSprite.material.SetColor("_OutlineColor", outlineColor);
        effectSprite.color = fillColor;
        return(effect);
    }
예제 #7
0
    public PhysicalEffect SpawnHitEffect(Vector3 position, float scale, Color fillColor = new Color())
    {
        GameObject     effectObject = Instantiate(effectPrefab, position, Quaternion.Euler(Vector3.zero));
        PhysicalEffect effect       = effectObject.GetComponent <PhysicalEffect>();

        effect.ScaleEffect(scale);
        effect.orientVertically = true;
        effect.direction        = Random.insideUnitCircle.normalized;
        effect.SkewEffect();
        effect.SetID(4);

        SpriteRenderer effectSprite = effectObject.GetComponent <SpriteRenderer>();

        effectSprite.sortingLayerName = "FG Effects";
        effectSprite.sortingOrder     = 0;
        effectSprite.color            = fillColor;
        return(effect);
    }
예제 #8
0
    void SetPhysicalEffect(PhysicalEffect effect)
    {
        switch (effect.physicalEffectType)
        {
        case PhysicalEffectType.Bleed:
            m_bleedEffects += effect.Amount;
            physicalEffects.Add(effect);
            effect.owner = this;
            effect.gameObject.transform.SetParent(this.gameObject.transform);
            break;

        case PhysicalEffectType.Infect:
            m_infectEffects += effect.Amount;
            physicalEffects.Add(effect);
            effect.owner = this;
            effect.gameObject.transform.SetParent(this.gameObject.transform);
            break;

        case PhysicalEffectType.Stun:

            // Stun cannot be dupilicated
            if (m_stunEffects == 0)
            {
                m_stunEffects++;
                physicalEffects.Add(effect);
                effect.owner = this;
                effect.gameObject.transform.SetParent(this.gameObject.transform);
            }
            break;

        case PhysicalEffectType.Buff:
            m_buffEffects++;
            physicalEffects.Add(effect);
            effect.owner = this;
            effect.gameObject.transform.SetParent(this.gameObject.transform);
            break;

        default:
            break;
        }
        UIManager.instance.CreateEffect(effect.Name, this, effect.Amount);
    }