Exemplo n.º 1
0
    public void TransformWeapon(PaintColor newColor)
    {
        SpriteRenderer spriteRenderer = GetComponent <SpriteRenderer>();

        switch (newColor)
        {
        case PaintColor.Red:
            spriteRenderer.color = RedColor;


            if (WeaponType == WeaponType.Sword)
            {
                TransformationType = ESoldierType.RedWarrior;
            }

            if (WeaponType == WeaponType.Hat)
            {
                TransformationType = ESoldierType.RedMage;
            }

            if (WeaponType == WeaponType.Crossbow)
            {
                TransformationType = ESoldierType.RedArcher;
            }

            break;

        case PaintColor.Blue:
            spriteRenderer.color = BlueColor;

            if (WeaponType == WeaponType.Sword)
            {
                TransformationType = ESoldierType.BlueWarrior;
            }

            if (WeaponType == WeaponType.Hat)
            {
                TransformationType = ESoldierType.BlueMage;
            }

            if (WeaponType == WeaponType.Crossbow)
            {
                TransformationType = ESoldierType.BlueArcher;
            }

            break;
        }
    }
Exemplo n.º 2
0
    public void PerformTransformation(ESoldierType transformationType)
    {
        GameObject transformationResult = null;

        foreach (var transfData in TransformationData)
        {
            if (transfData.Type == transformationType)
            {
                transformationResult = transfData.TransformationResult;
            }
        }

        if (transformationResult != null)
        {
            Instantiate(transformationResult, transform.position, Quaternion.identity);
            Destroy(this.gameObject);
        }
    }