Exemplo n.º 1
0
    public Berserker(string customName)
    {
        health       = new Attribute(Balancing.Berserker().health, "Time");
        actionPoints = new Attribute(Balancing.Berserker().actionPoints, "Turn");
        armor        = new Attribute(Balancing.Berserker().armor, "Turn");
        shield       = new Attribute(Balancing.Berserker().shield, "Turn");

        name             = customName;
        level            = 1;
        experiencePoints = 0;

        normalAttack = new ActiveAbility("Attack",
                                         Balancing.Berserker().minNormalAttack,
                                         Balancing.Berserker().maxNormalAttack,
                                         Balancing.Berserker().minRange,
                                         Balancing.Berserker().maxRange);

        activeAbilities  = new List <ActiveAbility>();
        passiveAbilities = new List <PassiveAbility>();
        //abilities fikses senere.
    }
Exemplo n.º 2
0
 public void Awake()
 {
     staticRef = this;
 }
Exemplo n.º 3
0
    void Start()
    {
        //S'il y a une erreur ici s'assurer que le prefab "Balancing" est bien dans la scène
        balanceData = GameObject.Find("Balancing").GetComponent <Balancing>();

        speed = balanceData.speedHookhead;

        rigid = GetComponent <Rigidbody2D>();
        coll  = GetComponent <PolygonCollider2D>();

        switch (playerNumber)
        {
        case "_P1":
            gameObject.layer = 12;
            break;

        case "_P2":
            gameObject.layer = 13;
            break;

        case "_P3":
            gameObject.layer = 14;
            break;

        case "_P4":
            gameObject.layer = 15;
            break;

        default:
            print("Default case switch start Projectile.cs");
            break;
        }

        switch (hook.player.GetComponent <SpriteRenderer>().sprite.name)
        {
        case "0":
            hitHook = hitHookOrange;
            break;

        case "1":
            hitHook = hitHookPink;
            break;

        case "2":
            hitHook = hitHookBlue;
            break;

        case "3":
            hitHook = hitHookGreen;
            break;

        case "4":
            hitHook = hitHookYellow;
            break;

        default:
            break;
        }

        raycastBackRange = raycastRange * 3.5f;
    }
Exemplo n.º 4
0
    void Start()
    {
        Application.targetFrameRate = 60;
        //S'il y a une erreur ici s'assurer que le prefab "Balancing" est bien dans la scène
        balanceData = GameObject.Find("Balancing").GetComponent <Balancing>();

        groundedControlForce = balanceData.groundedControlForce;
        hookMovementForce    = balanceData.hookMovementForce;
        airControlForce      = balanceData.airControlForce;
        dashTime             = balanceData.dashTime;
        dashForce            = balanceData.dashForce;
        dashCDTime           = balanceData.attackCDTime;
        dragEndOfDash        = balanceData.dragEndOfDash;
        inDashStatusTime     = balanceData.inDashStatusTime;

        rigid                   = this.GetComponent <Rigidbody2D>();
        speedEffectScript       = speedEffect.GetComponent <SpeedEffect>();
        dashReadyEffect         = transform.GetChild(2).gameObject;
        dashEffectColor         = dashReadyEffect.GetComponent <ParticleSystem>().main;
        dashEffectColorLifeTime = dashReadyEffect.GetComponent <ParticleSystem>().colorOverLifetime;
        lifeManager             = GetComponent <PlayerLifeManager>();

        dashRecovery = Resources.Load <GameObject>("Prefabs/Dash/DashRecovery");

        gravity = rigid.gravityScale;

        playerSprite = GetComponent <SpriteRenderer>().sprite;

        switch (playerNumber)
        {
        case "_P1":
            gameObject.layer = 8;
            break;

        case "_P2":
            gameObject.layer = 9;
            break;

        case "_P3":
            gameObject.layer = 10;
            break;

        case "_P4":
            gameObject.layer = 11;
            break;

        default:
            break;
        }

        lastFramePosition = transform.position;

        //Switch gérant la couleur du dash effect
        switch (playerSprite.name)
        {
        case "0":
            dashEffectColor.startColor = new Color(1, 1, 0);
            colorDashEffect[1].color   = new Color(.9215686f, 0.7294118f, 0.345098f);
            break;

        case "1":
            dashEffectColor.startColor = new Color(0.9960784f, 0.5686275f, 0.7568628f);
            colorDashEffect[1].color   = new Color(0.9960784f, 0.5686275f, 0.7568628f);
            break;

        case "2":
            dashEffectColor.startColor = new Color(0, 1, 1);
            colorDashEffect[1].color   = new Color(0.2313726f, 0.572549f, 0.9882353f);
            break;

        case "3":
            dashEffectColor.startColor = new Color(.3f, 1, 0);
            colorDashEffect[1].color   = new Color(0.4627451f, 0.7372549f, 0.2862745f);
            break;

        case "4":
            dashEffectColor.startColor = new Color(1, 0, 0);
            colorDashEffect[1].color   = new Color(0.9098039f, 0.1176471f, 0.3176471f);
            break;

        default:
            print("Default case switch start PlayerMovement.cs");
            break;
        }
        alphaDashEffect[0].alpha = 1;
        alphaDashEffect[0].time  = 0;
        alphaDashEffect[1].alpha = 1;
        alphaDashEffect[1].time  = 1;
        colorDashEffect[0].color = new Color(1, 1, 1);
        colorDashEffect[0].time  = 0;
        colorDashEffect[1].time  = 1;
        Gradient grad = new Gradient();

        grad.SetKeys(colorDashEffect, alphaDashEffect);
        dashEffectColorLifeTime.color = grad;
    }
Exemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     balanceData = GameObject.Find("Balancing").GetComponent <Balancing>();
 }
Exemplo n.º 6
0
 private void UpdateText()
 {
     unitText.text = "Available Workers: " + workers.Available + " / " + workers.Amount + "\n"
                     + "(" + Balancing.MetalCostForNextWorker(workers.Amount) + " Metal, " + Balancing.CrystalCostForNextWorker(workers.Amount) + " Crystal)";
 }
Exemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        //S'il y a une erreur ici s'assurer que le prefab "Balancing" est bien dans la scène
        balanceData = GameObject.Find("Balancing").GetComponent <Balancing>();

        playerHP             = balanceData.playerMaxHP;
        recoveryTime         = balanceData.recoveryTime;
        flashingRate         = balanceData.flashingRate;
        knockBackTime        = balanceData.knockBackTime;
        knockBackLaser       = balanceData.knockBackLaser;
        knockBackBlade1      = balanceData.knockBackBlade1;
        knockBackBlade2      = balanceData.knockBackBlade2;
        knockBackBlade3      = balanceData.knockBackBlade3;
        knockBackMeteor      = balanceData.knockBackMeteor;
        laserDamage          = balanceData.laserDamage;
        criticalSpeed        = balanceData.criticalSpeed;
        lastAttackerDuration = balanceData.lastAttackerDuration;
        freezeFrameDuration  = balanceData.freezeFrameDuration;
        thornsDamage         = balanceData.thornsDamage;
        knockBackThorns      = balanceData.knockBackThorns;

        playerMovement             = GetComponent <PlayerMovement>();
        trail                      = GetComponent <TrailRenderer>();
        lifeParticlesManagerScript = lifeParticlesManager.GetComponent <LifeParticlesManager>();
        sprite                     = GetComponent <SpriteRenderer>();
        startMaterial              = sprite.material;

        FbOnDeath = GameObject.Find("LevelScripts").GetComponent <FeedbacksOnDeath> ();

        woundedMaterial = Resources.Load <Material>("Material/SpriteBlink" + playerMovement.playerNumber);

        //Switch gérant la couleur de la trail et la couleur des particules
        switch (sprite.sprite.name)
        {
        case "0":
            colorTrail[0].color = new Color(.9215686f, 0.7294118f, 0.345098f);
            colorTrail[1].color = new Color(0.9647059f, 0.5882353f, 0.2235294f);
            deathParticle       = Resources.Load <ParticleSystem>("Particles/Nuke/NukeOrange");
            hitLittle           = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleOrange");
            hitHard             = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardOrange");
            hitLaser            = Resources.Load <ParticleSystem>("Particles/LaserHitPlayer/LaserHitPlayerOrange");
            break;

        case "1":
            colorTrail[0].color = new Color(0.9960784f, 0.5686275f, 0.7568628f);
            colorTrail[1].color = new Color(0.8705882f, 0.282353f, 0.5137255f);
            deathParticle       = Resources.Load <ParticleSystem>("Particles/Nuke/NukePink");
            hitLittle           = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittlePink");
            hitHard             = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardPink");
            hitLaser            = Resources.Load <ParticleSystem>("Particles/LaserHitPlayer/LaserHitPlayerPink");
            break;

        case "2":
            colorTrail[0].color = new Color(0.2313726f, 0.572549f, 0.9882353f);
            colorTrail[1].color = new Color(0.04313726f, 0.4117647f, 0.5882353f);
            deathParticle       = Resources.Load <ParticleSystem>("Particles/Nuke/NukeBlue");
            hitLittle           = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleBlue");
            hitHard             = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardBlue");
            hitLaser            = Resources.Load <ParticleSystem>("Particles/LaserHitPlayer/LaserHitPlayerBlue");
            break;

        case "3":
            colorTrail[0].color = new Color(0.4627451f, 0.7372549f, 0.2862745f);
            colorTrail[1].color = new Color(0.3294118f, 0.6470588f, 0.1960784f);
            deathParticle       = Resources.Load <ParticleSystem>("Particles/Nuke/NukeGreen");
            hitLittle           = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleGreen");
            hitHard             = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardGreen");
            hitLaser            = Resources.Load <ParticleSystem>("Particles/LaserHitPlayer/LaserHitPlayerGreen");
            break;

        case "4":
            colorTrail[0].color = new Color(0.9098039f, 0.1176471f, 0.3176471f);
            colorTrail[1].color = new Color(0.509804f, 0.02352941f, 0.2784314f);
            deathParticle       = Resources.Load <ParticleSystem>("Particles/Nuke/NukeYellow");
            hitLittle           = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleYellow");
            hitHard             = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardYellow");
            hitLaser            = Resources.Load <ParticleSystem>("Particles/LaserHitPlayer/LaserHitPlayerYellow");
            break;

        default:
            print("Default case switch start PlayerLifeManager.cs");
            break;
        }
        alphaTrail[0].alpha = 1;
        alphaTrail[0].time  = 0;
        alphaTrail[1].alpha = 0;
        alphaTrail[1].time  = 1;
        colorTrail[0].time  = 0;
        colorTrail[1].time  = 1;
        trailGradient.SetKeys(colorTrail, alphaTrail);
        trail.colorGradient = trailGradient;

        GradientAlphaKey[] alphaKeys = new GradientAlphaKey[2];
        alphaKeys[0].alpha = .157f;
        alphaKeys[0].time  = 0;
        alphaKeys[1]       = trailGradient.alphaKeys[1];
        woundedGradient.SetKeys(trailGradient.colorKeys, alphaKeys);
    }
Exemplo n.º 8
0
 private void UpdateResourceCounterText()
 {
     resourceAmountText.text = resourceType.ToString() + ": " + resource.Amount;
     workerAmountText.text   = "Workers: " + resource.AssignedWorkers + " / " + Balancing.MaximumWorkersPossible(building.CurrentLevel);
 }
Exemplo n.º 9
0
 private void RecalculateIncrementPerCycle()
 {
     cycleSpeed        = Balancing.CycleSpeed(resourceType);
     incrementPerCycle = Balancing.IncrementPerCycle(resourceType, building.CurrentLevel);
     UpdateResourceCounterText();
 }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        /*
         * hookInCD = false;
         * hooked = false;*/

        //S'il y a une erreur ici s'assurer que le prefab "Balancing" est bien dans la scène
        balanceData           = GameObject.Find("Balancing").GetComponent <Balancing>();
        timeHooked            = balanceData.TimeHooked;
        retractationStep      = balanceData.retractationStep;
        timeBtwShots          = balanceData.timeBtwShots;
        knockBackTime         = balanceData.knockBackTime;
        knockBackBlade1       = balanceData.knockBackBlade1;
        knockBackBlade2       = balanceData.knockBackBlade2;
        knockBackBlade3       = balanceData.knockBackBlade3;
        blade1damage          = balanceData.blade1Damage;
        blade2damage          = balanceData.blade2Damage;
        blade3damage          = balanceData.blade3Damage;
        hookRecuperationSpeed = balanceData.hookRecuperationSpeed;
        criticalSpeed         = balanceData.criticalSpeed;
        timeBeforeDestroy     = balanceData.timeRopeCut;
        attackTime            = balanceData.attackTime;
        freezeFrameDuration   = balanceData.freezeFrameDuration;
        knockBackAttacker     = balanceData.knockBackAttacker;

        timeRemaining = timeHooked;

        //Récupère tout les éléments du gameObject
        bladeColliders            = GetComponents <PolygonCollider2D>();
        blade1Collider            = bladeColliders[2];
        blade2Collider            = bladeColliders[1];
        blade3Collider            = bladeColliders[0];
        bladeRenderer             = transform.GetChild(1).GetComponent <SpriteRenderer>();
        playerMovement            = player.GetComponent <PlayerMovement>();
        playerNumber              = playerMovement.playerNumber;
        playerMovement.hookScript = this;
        spriteRenderer            = GetComponent <SpriteRenderer>();
        lifeManager             = player.GetComponent <PlayerLifeManager>();
        lifeManager.spriteArrow = spriteRenderer;
        lifeManager.hookScript  = this;
        hookUnvailableAnimator  = hookUnvailable.GetComponent <Animator>();
        hookUnvailable.gameObject.SetActive(false);

        //Détruit le line renderer s'il existait déjà pour éviter le duplicata
        // if (this.transform.parent.transform.childCount == 5)
        //     Destroy(this.transform.parent.transform.GetChild(4).gameObject);

        //Crée le line renderer et le configure
        line = new GameObject("Line").AddComponent <LineRenderer>(); //instantie un line renderer
        line.positionCount = 2;                                      //le nombre de point pour la ligne
        line.startWidth    = balanceData.lineWidth;                  // la largeur de la ligne
        line.endWidth      = balanceData.lineWidth;
        line.gameObject.SetActive(false);                            // désactive la ligne
        line.startColor = colorRope;
        line.endColor   = colorRope;
        line.GetComponent <Renderer>().material.shader = Shader.Find("Particles/Alpha Blended");
        line.GetComponent <Renderer>().material.color  = Color.black;// couleur du matérial
        line.transform.parent = gameObject.transform.parent;
        rope = Resources.Load <Texture>("ArrowSprites/Rope");
        line.material.SetTexture("_MainTex", rope);

        //Ajoute un collider à la corde ainsi que le script qui permet de la couper
        line.gameObject.AddComponent <BoxCollider2D>();
        line.gameObject.AddComponent <LineCutter>();
        line.gameObject.GetComponent <LineCutter>().hook = this;
        lineCollider           = line.GetComponent <BoxCollider2D>();
        lineCollider.isTrigger = true;
        line.gameObject.tag    = "Rope";
        line.sortingLayerName  = "Rope";

        //Charge les sprites en fonction du personnage sélectionné
        switch (player.GetComponent <SpriteRenderer>().sprite.name)
        {
        case "0":
            arrowSprite    = Resources.Load <Sprite>("ArrowSprites/Arrow0");
            hookheadSprite = Resources.Load <Sprite>("ArrowSprites/Hook0");
            colorRope      = new Color(.9215686f, 0.7294118f, 0.345098f);
            hitLittle      = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleOrange");
            hitHard        = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardOrange");
            break;

        case "1":
            arrowSprite    = Resources.Load <Sprite>("ArrowSprites/Arrow1");
            hookheadSprite = Resources.Load <Sprite>("ArrowSprites/Hook1");
            colorRope      = new Color(0.9960784f, 0.5686275f, 0.7568628f);
            hitLittle      = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittlePink");
            hitHard        = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardPink");
            break;

        case "2":
            arrowSprite    = Resources.Load <Sprite>("ArrowSprites/Arrow2");
            hookheadSprite = Resources.Load <Sprite>("ArrowSprites/Hook2");
            colorRope      = new Color(0.2313726f, 0.572549f, 0.9882353f);
            hitLittle      = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleBlue");
            hitHard        = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardBlue");
            break;

        case "3":
            arrowSprite    = Resources.Load <Sprite>("ArrowSprites/Arrow3");
            hookheadSprite = Resources.Load <Sprite>("ArrowSprites/Hook3");
            colorRope      = new Color(0.4627451f, 0.7372549f, 0.2862745f);
            hitLittle      = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleGreen");
            hitHard        = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardGreen");
            break;

        case "4":
            arrowSprite    = Resources.Load <Sprite>("ArrowSprites/Arrow4");
            hookheadSprite = Resources.Load <Sprite>("ArrowSprites/Hook4");
            colorRope      = new Color(0.9098039f, 0.1176471f, 0.3176471f);
            hitLittle      = Resources.Load <ParticleSystem>("Particles/HitLittle/HitLittleYellow");
            hitHard        = Resources.Load <ParticleSystem>("Particles/HitHard/HitHardYellow");
            break;

        default:
            print("Default case switch start Hook.cs");
            break;
        }
        blade1Sprite = Resources.Load <Sprite>("ArrowSprites/Blade1");
        blade2Sprite = Resources.Load <Sprite>("ArrowSprites/Blade2");
        blade3Sprite = Resources.Load <Sprite>("ArrowSprites/Blade3");
        //Initialise le joueur avec la flèche et sans lame
        spriteRenderer.sprite = arrowSprite;
        Sheathe();

        //Fixe les différents layer en fonction du numéro du joueur
        switch (playerNumber)
        {
        case "_P1":
            line.gameObject.layer = 17;
            gameObject.layer      = 17;
            layerMaskLineCast     = (1 << 18) | (1 << 19) | (1 << 20) | (1 << 22) | (1 << 23) | (1 << 24) | (1 << 26);
            layerMaskOthersArrow  = (1 << 18) | (1 << 19) | (1 << 20);
            break;

        case "_P2":
            line.gameObject.layer = 18;
            gameObject.layer      = 18;
            layerMaskLineCast     = (1 << 17) | (1 << 19) | (1 << 20) | (1 << 21) | (1 << 23) | (1 << 24) | (1 << 26);
            layerMaskOthersArrow  = (1 << 17) | (1 << 19) | (1 << 20);
            break;

        case "_P3":
            line.gameObject.layer = 19;
            gameObject.layer      = 19;
            layerMaskLineCast     = (1 << 17) | (1 << 18) | (1 << 20) | (1 << 21) | (1 << 22) | (1 << 24) | (1 << 26);
            layerMaskOthersArrow  = (1 << 17) | (1 << 18) | (1 << 20);
            break;

        case "_P4":
            line.gameObject.layer = 20;
            gameObject.layer      = 20;
            layerMaskLineCast     = (1 << 17) | (1 << 18) | (1 << 19) | (1 << 21) | (1 << 22) | (1 << 23) | (1 << 26);
            layerMaskOthersArrow  = (1 << 17) | (1 << 18) | (1 << 19);
            break;

        default:
            print("Default case switch start Hook.cs");
            break;
        }
    }
Exemplo n.º 11
0
 public void BuildingUpgradeButtonClicked()
 {
     (int nextLevelMetalCost, int nextLevelCrystalCost) = Balancing.BuldingUpgradeCost(resourceType, building.MaximumLevel + 1);
     BuyUpgrade(nextLevelMetalCost, nextLevelCrystalCost);
     UpdateData();
 }