public void SetPower(int active, int timer = 0)
        {
            power = (ActivePower)active;

            switch (power)
            {
            case ActivePower.none:
                movementSettings.ForwardSpeed  = startSpeedF;
                movementSettings.BackwardSpeed = startSpeedB;
                movementSettings.StrafeSpeed   = startSpeedS;
                movementSettings.JumpForce     = startJump;
                movementSettings.MaxJumps      = startJumps;
                break;

            case ActivePower.speed:
                movementSettings.ForwardSpeed  *= 2;
                movementSettings.BackwardSpeed *= 2;
                movementSettings.StrafeSpeed   *= 2;
                break;

            case ActivePower.superJump:
                movementSettings.JumpForce *= 3;
                break;

            case ActivePower.doubleJump:
                movementSettings.MaxJumps++;
                break;
            }

            powerTime = timer;
        }
Пример #2
0
    void GetInput()
    {
        firePower.input = Input.GetAxis(firePower.INPUT_AXIS);
        tileDrop.input = Input.GetAxis(tileDrop.INPUT_AXIS);
        bombTrap.input = Input.GetAxis(bombTrap.INPUT_AXIS);
        if (Input.GetAxis(firePower.ACTIVATE_INPUT) > 0)
        {
            activePower = ActivePower.FireBall;

            if (tileDrop.selectedTile)
                tileDrop.selectedTile.GetComponent<Renderer>().materials[0].color = tileDrop.selectedTile.GetComponent<TileBehavior>().initialColor;

            firePower.PowerSelectedArrow.SetActive(true);
            tileDrop.PowerSelectedArrow.SetActive(false);
            bombTrap.PowerSelectedArrow.SetActive(false);
        }
        else if (Input.GetAxis(tileDrop.ACTIVATE_INPUT) > 0)
        {
            activePower = ActivePower.TileDrop;
            firePower.PowerSelectedArrow.SetActive(false);
            tileDrop.PowerSelectedArrow.SetActive(true);
            bombTrap.PowerSelectedArrow.SetActive(false);
        }
        else if (Input.GetAxis(bombTrap.ACTIVATE_INPUT) > 0)
        {
            activePower = ActivePower.BombTrap;

            if (tileDrop.selectedTile)
                tileDrop.selectedTile.GetComponent<Renderer>().materials[0].color = tileDrop.selectedTile.GetComponent<TileBehavior>().initialColor;

            firePower.PowerSelectedArrow.SetActive(false);
            tileDrop.PowerSelectedArrow.SetActive(false);
            bombTrap.PowerSelectedArrow.SetActive(true);
        }
    }
Пример #3
0
 void Start()
 {
     activePower = ActivePower.FireBall;
     firePower.PowerSelectedArrow.SetActive(true);
     tileDrop.PowerSelectedArrow.SetActive(false);
     bombTrap.PowerSelectedArrow.SetActive(false);
     ArchitectCanvas = transform.GetChild(0).gameObject;
     ArchitectCanvas.transform.parent = null;
 }
Пример #4
0
 public void SwitchActivePower()
 {
     if (activePower == ActivePower.LineField)
     {
         activePower = ActivePower.BungeeGem;
     }
     else if (activePower == ActivePower.BungeeGem)
     {
         activePower = ActivePower.LineField;
     }
 }
Пример #5
0
        public LineReactivePowerBalanceEquation(Voltage Ui, ActivePower Pij, ReactivePower Qij, ReactivePower Qji, Constant x)
        {
            this.Ui  = Ui;
            this.Pij = Pij;
            this.Qij = Qij;
            this.Qji = Qji;
            this.X   = x;

            AddToArguments(Ui);
            AddToArguments(Pij);
            AddToArguments(Qij);
            AddToArguments(Qji);
            AddToConstants(x);
        }
        public LineActivePowerBalanceEquation(Voltage Ui, ActivePower Pij, ReactivePower Qij, ActivePower Pji, Constant r)
        {
            this.Ui  = Ui;
            this.Pij = Pij;
            this.Qij = Qij;
            this.Pji = Pji;
            this.R   = r;

            AddToArguments(Ui);
            AddToArguments(Pij);
            AddToArguments(Qij);
            AddToArguments(Pji);
            AddToConstants(r);
        }
Пример #7
0
    void GetInput()
    {
        throwPower.input = Input.GetAxis(throwPower.INPUT_AXIS);
        attackPower.input = Input.GetAxis(attackPower.INPUT_AXIS);
        if (Input.GetAxis(throwPower.ACTIVATE_INPUT) > 0)
        {
            activePower = ActivePower.Throw;

            throwPower.PowerSelectedArrow.SetActive(true);
            attackPower.PowerSelectedArrow.SetActive(false);
        }
        else if (Input.GetAxis(attackPower.ACTIVATE_INPUT) > 0)
        {
            activePower = ActivePower.Attack;
            throwPower.PowerSelectedArrow.SetActive(false);
            attackPower.PowerSelectedArrow.SetActive(true);
        }
    }
        public ControlEquation1(Voltage Ui, Voltage Uj, ActivePower Pij, ReactivePower Qij, ActivePower Pji, Constant r, Constant x, Constant b)
        {
            this.Ui  = Ui;
            this.Pij = Pij;
            this.Qij = Qij;
            this.Pji = Pji;
            this.R   = r;
            this.R   = x;
            this.B   = b;

            AddToArguments(Ui);
            AddToArguments(Pij);
            AddToArguments(Qij);
            AddToArguments(Pji);
            AddToConstants(r);
            AddToConstants(x);
            AddToConstants(b);
        }
    // Update is called once per frame
    void Update()
    {
        currentPower = abilityBehaviours.getCurrentPower();
        /*if (input.isPrevPower() || input.isNextPower()) {
            currentPower = abilityBehaviours.getCurrentPower();
        }*/

        /*if (CrossPlatformInputManager.GetButtonDown ("Fire1"))//LOGIO
        {
            currentPower = ActivePower.Logio;
        }
        else if (CrossPlatformInputManager.GetButtonDown ("Fire2"))//IMAGI
        {
            currentPower = ActivePower.Imagi;
        }
        else if (CrossPlatformInputManager.GetButtonDown ("Fire3"))//VOID
        {
            currentPower = ActivePower.Void;
        }*/

        switch (currentPower)
        {
        case ActivePower.Logio:
            //uiIndicator.color = LogioC;
            uiBar.sprite = logioImage;
            uiCross.sprite = logioCross;
            powerBar.BarType = ResourceType.Logio;
            break;
        case ActivePower.Imagi:
            //uiIndicator.color = ImagiC;
            uiBar.sprite = imagiImage;
            uiCross.sprite = imagiCross;
            powerBar.BarType = ResourceType.Imagi;
            break;
        case ActivePower.Void:
            //uiIndicator.color = VoidC;
            uiBar.sprite = voidImage;
            uiCross.sprite = voidCross;
            powerBar.BarType = ResourceType.Void;
            break;

        }
    }
    private void Start()
    {
        // Gets The Main Camera's Transform On Object Startup
        myCameraTransform = Camera.main.GetComponent<Transform>();
        input = gameObject.GetComponent<InputHandler>();
        currentPower = ActivePower.Imagi;

        playerStats = GetComponent<PlayerStats>();

        AudioSource[] audioSources = GetComponentsInChildren<AudioSource>();
        foreach (AudioSource temp in audioSources)
        {
            if (temp.name == "AudioSourceBullet")
            {
                audioSourceBullets = temp;
            }
        }

        armAnimator = Arms.GetComponent<Animator>();

        isCasting = false;
        cantCast = false;
    }
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }
        if (active != ActivePower.Speed && !cooloff)
        {
            if (gameObject.GetComponent <NetworkedThirdPersonUserControl>().running&& stamina.value != stamina.minValue)
            {
                stamina.value -= 1.0f;
            }
            else if (gameObject.GetComponent <NetworkedThirdPersonUserControl>().running&& stamina.value <= stamina.minValue)
            {
                gameObject.GetComponent <NetworkedThirdPersonUserControl>().allowRunning = false;
                stamina.value += 1.0f;
                cooloff        = true;
            }
            else if (!gameObject.GetComponent <NetworkedThirdPersonUserControl>().running&& stamina.value != stamina.maxValue)
            {
                stamina.value += 1.0f;
            }
        }
        else if (cooloff)
        {
            gameObject.GetComponent <NetworkedThirdPersonUserControl>().allowRunning = false;

            cooldown      -= Time.deltaTime;
            stamina.value += 1.0f;

            if (cooldown <= 0.0f)
            {
                cooldown = 5.0f;
                cooloff  = false;
                gameObject.GetComponent <NetworkedThirdPersonUserControl>().allowRunning = true;
            }
        }


        if (power && !timer.gameObject.activeInHierarchy)
        {
            timer.gameObject.SetActive(true);
            timer.value = 300;
        }
        else if (!power && timer.gameObject.activeInHierarchy)
        {
            timer.gameObject.SetActive(false);
        }

        if (timer.gameObject.activeInHierarchy)
        {
            if (timer.value <= 0)
            {
                power = false;
            }
            timer.value -= 1 * Time.deltaTime;


            if (pow == PowerName.UnlimitedStamina && active != ActivePower.Speed)
            {
                the_pickup.GetComponent <UnlimitedStamina>().Triggered();
                active = ActivePower.Speed;
            }
            else if (pow == PowerName.PowerBoost && active != ActivePower.Power)
            {
                the_pickup.GetComponent <PowerBoost>().Triggered();
                if (!weaponOutputDoubled)
                {
                    StartCoroutine(DoubleWeaponOutput(gameObject.GetComponent <NetworkedThirdPersonCharacter>()));
                }
                active = ActivePower.Power;
            }
            else if (pow == PowerName.WeaponRecharge && active != ActivePower.Weapon)
            {
                the_pickup.GetComponent <WeaponRecharge>().Triggered();
                gameObject.GetComponent <NetworkedThirdPersonCharacter> ().currentWeaponTime = 0.0f;
                active = ActivePower.Weapon;
            }
            else if (pow == PowerName.NullifyFear && active != ActivePower.Nullify)
            {
                the_pickup.GetComponent <NullifyFear>().Triggered();
                active = ActivePower.Nullify;
            }

            //power_obtained.text = power_name;
            var cb = timer.colors;
            cb.normalColor = temp;
            timer.colors   = cb;
        }
        else
        {
            // power_obtained.text = "No power";
            active = ActivePower.None;
        }
    }
Пример #12
0
 public override string GetHelpText() => $"{(!string.IsNullOrEmpty(Tooltip) ? $"{Tooltip}{Environment.NewLine}" : "")}{VoltageInfo} × {CurrentInfo}{((Current.Phase != 0.0) ? $" × {Math.Cos(Current.Phase).ToString("f2")}<sub>Pf</sub>" : "")} = {((ActivePower > 1000) ? $"{(ActivePower / 1000).ToString("f2")} KW" : $"{ActivePower.ToString("f2")} Watts")}{Environment.NewLine}Click to turn {(IsClosed ? "off" : "on")}";
Пример #13
0
 public void SetPowerLine()
 {
     activePower = ActivePower.LineField;
 }
Пример #14
0
 public override string GetHelpText() => $"Voltage = {Voltage.ToString("f3")} V{Environment.NewLine}Current = {Current.ToString("f3")} A{Environment.NewLine}Wattage = {ActivePower.ToString("f2")} Watts";
Пример #15
0
 public void SetPowerBungee()
 {
     activePower = ActivePower.BungeeGem;
 }
Пример #16
0
 public void SetPowerInertia()
 {
     activePower = ActivePower.InertiaField;
 }
    private void Update()
    {
        //Switches for next and previous powers
        if (input.isPrevPower ())
        {
            switch(currentPower)
            {
                case ActivePower.Logio:
                    currentPower = ActivePower.Void;
                    break;
                case ActivePower.Imagi:
                    currentPower = ActivePower.Logio;
                    break;
                case ActivePower.Void:
                    currentPower = ActivePower.Imagi;
                    break;
            }
        }

        if (input.isNextPower ())
        {
            switch(currentPower)
            {
                case ActivePower.Logio:
                    currentPower = ActivePower.Imagi;
                    break;
                case ActivePower.Imagi:
                    currentPower = ActivePower.Void;
                    break;
                case ActivePower.Void:
                    currentPower = ActivePower.Logio;
                    break;
            }
        }

        // Check if we can shoot
        // Providing we have pressed the button, arent paused,
        //arent casting or waiting for cooldown and have the resources to do so
        if (input.isShoot() && Time.timeScale != 0 && !isCasting && !cantCast && canFire())
        {
            StartCoroutine(Cast());
        }
        if(!input.isShoot() && !isCasting)
        {
            // Check for power switching
            if (CrossPlatformInputManager.GetButtonDown("Fire1") && !logioLock)//LOGIO
            {
                currentPower = ActivePower.Logio;
            }

            if (CrossPlatformInputManager.GetButtonDown("Fire2") && !imagiLock)//IMAGI
            {
                currentPower = ActivePower.Imagi;
            }

            if (CrossPlatformInputManager.GetButtonDown("Fire3") && !voidLock)//VOID
            {
                currentPower = ActivePower.Void;
            }
        }
    }
Пример #18
0
 void Start()
 {
     activePower = ActivePower.Throw;
     throwPower.PowerSelectedArrow.SetActive(true);
     attackPower.PowerSelectedArrow.SetActive(false);
 }
 public void setActivePower(ActivePower ap)
 {
     currentPower = ap;
 }
Пример #20
0
 void Start()
 {
     activePower  = ActivePower.LineField;
     maxStretchSq = Mathf.Pow(maxStretch, 2);
     lManager     = GameObject.Find("GameManager").GetComponent <LevelManager> ();
 }     // end Start