コード例 #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);
    }