コード例 #1
0
    // Use this for initialization
    void Start()
    {
        // Local setup stuff
        if (!isLocalPlayer)
        {
            return;
        }

        FindReferences();

        multManager = GameObject.FindGameObjectWithTag("MultiplayerManager").GetComponent <Multiplayer_Manager>();
        team        = GetCurTeam();
        CmdSpawnMyFlagship(team);
        CmdIncrementCurTeam();


        gameManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <Manager_Game>();
        gameRules   = gameManager.GameRules;       // Grab copy of Game Rules
        SetCommander(gameManager.GetCommander(team));
        gameManager.SetController(this);

        selection = new List <Entity>();
        Select(null, false);

        audioSource = GetComponent <AudioSource>();

        lineMouse.SetEffectActive(0);
        lineVert.SetEffectActive(0);

        SetMarqueeActive(false);

        commandWheel.SetController(this);
        SetCommandWheelActive(false);
    }
コード例 #2
0
    new void Update()
    {
        base.Update();

        if (targetUnit)
        {
            if (!targetUnit.IsDead() && InRange(targetUnit.transform, gameRules.ABLY_shieldProjectRange))
            {
                activeRegenTimer -= Time.deltaTime;
                if (activeRegenTimer <= 0)
                {
                    if (shieldMod.shieldPercent < 1)
                    {
                        float increment = (gameRules.ABLY_shieldProjectOnGPS / gameRules.ABLY_shieldProjectMaxPool) * Time.deltaTime;
                        if (shieldMod.shieldPercent >= 0)
                        {
                            shieldMod.shieldPercent = Mathf.Min(shieldMod.shieldPercent + increment, 1);
                        }
                        UpdateAbilityBar();
                        targetUnit.OnShieldChange();                         // Update target unit's HP bar
                    }
                }

                UpdateActiveEffects();
            }
            else             // Left range
            {
                // Return shield and put on cooldown
                StartCooldown();
                ProjectShield(parentUnit);
            }
        }
        else
        {
            if (checkIfDead)
            {
                lineEffect.SetEffectActive(0);
                pointEffect.SetEffectActive(false);
                audioLoop.SetEffectActive(false);
                checkIfDead = false;
            }

            // While inactive, constantly regenerate shieldPercent
            if (shieldMod.shieldPercent < 1)
            {
                float increment = (gameRules.ABLY_shieldProjectOffGPS / gameRules.ABLY_shieldProjectMaxPool) * Time.deltaTime;
                if (shieldMod.shieldPercent >= 0)
                {
                    shieldMod.shieldPercent = Mathf.Min(shieldMod.shieldPercent + increment, 1);
                }
                else                 // Accelerated regeneration if in negative pool
                {
                    shieldMod.shieldPercent = Mathf.Min(shieldMod.shieldPercent + increment * gameRules.ABLY_shieldProjectOffGPSNegMult, 1);
                }
                UpdateAbilityBar();
            }
        }
    }
コード例 #3
0
    new void Update()
    {
        base.Update();

        if (targetUnit)
        {
            if (InRange(targetUnit.transform))
            {
                targetUnit.AddVelocityMod(new VelocityMod(parentUnit, parentUnit.GetVelocity(), VelocityModType.Chain));

                // Position and enable line effect
                lineEffect.SetEffectActive(1, chainStart.position, targetUnit.transform.position);

                // Particle effects placed at each end of the chain
                chainEndsEffect[0].transform.position = chainStart.position;
                chainEndsEffect[0].transform.rotation = Quaternion.LookRotation(targetUnit.transform.position - chainStart.position);
                chainEndsEffect[1].transform.position = targetUnit.transform.position;
                chainEndsEffect[1].transform.rotation = Quaternion.LookRotation(chainStart.position - targetUnit.transform.position);

                audioLoop.transform.position = (chainStart.position + targetUnit.transform.position) * 0.5f;
            }
            else             // Chain breaks
            {
                Instantiate(pointEffectBreakPrefab, (chainStart.position + targetUnit.transform.position) * 0.5f, Quaternion.LookRotation(chainStart.position - targetUnit.transform.position));
                ClearTarget(true);
                StartCooldown();                 // TODO: Maybe not
            }
        }
        else
        {
            if (checkingForDead)
            {
                ClearTarget(true);
                StartCooldown();                 // TODO: Maybe not
            }
        }
    }
コード例 #4
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        lineEffect = Instantiate(lineEffectPrefab, transform.position, Quaternion.identity);
        lineEffect.SetEffectActive(0);

        chainEndsEffect    = new Effect_Point[2];
        chainEndsEffect[0] = Instantiate(chainEndsEffectPrefab, transform.position, Quaternion.identity);
        chainEndsEffect[1] = Instantiate(chainEndsEffectPrefab, transform.position, Quaternion.identity);
        chainEndsEffect[0].SetEffectActive(false);
        chainEndsEffect[1].SetEffectActive(false);

        audioLoop = Instantiate(audioLoopPrefab, transform.position, Quaternion.identity);
        audioLoop.SetEffectActive(false);
    }
コード例 #5
0
    // Use this for initialization
    new void Start()
    {
        base.Start();

        shieldMod  = new ShieldMod(parentUnit, 1, ShieldModType.ShieldProject);
        abilityBar = parentUnit.hpBar.GetComponent <UI_AbilBar_ShieldProject>();
        abilityBar.SetShield(shieldMod.shieldPercent, shieldMod.shieldPercent < 0);

        lineEffect = Instantiate(lineEffectPrefab, transform.position, Quaternion.identity);
        lineEffect.SetEffectActive(0);

        pointEffect = Instantiate(pointEffectPrefab, transform.position, Quaternion.identity);
        pointEffect.SetEffectActive(false);

        audioLoop = Instantiate(audioLoopPrefab, transform.position, Quaternion.identity);
        audioLoop.SetEffectActive(false);
    }