Exemplo n.º 1
0
    private void PlayUnhackEffect(SystemElementController systemElementController, VirusValue virus)
    {
        if (unhackParticles != null)
        {
            unhackParticles.transform.position = systemElementController.transform.position;

            Gradient gradient   = new Gradient();
            Color    startColor = systemElementController.SystemElement.OwnerVirus.Color;
            gradient.SetKeys(
                new GradientColorKey[]
            {
                new GradientColorKey(startColor, 0.0f), new GradientColorKey(Color.white, 0.3f)
            },
                new GradientAlphaKey[]
            {
                new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(1.0f, 0.8f)
            }
                );

            var col = hackParticles.colorOverLifetime;
            col.enabled = true;
            col.color   = gradient;

            unhackParticles.Play();
        }
    }
 private void ElementActionHandle(SystemElementController controller, VirusValue virus)
 {
     if (gameObject.activeInHierarchy)
     {
         UpdateView();
     }
 }
Exemplo n.º 3
0
    private void PlayHackEffect(SystemElementController systemElementController, VirusValue virus)
    {
        if (hackParticles != null)
        {
            hackParticles.transform.position = systemElementController.transform.position;

            //ParticleSystem.MinMaxGradient gradient = hackParticles.colorOverLifetime.color;
            //gradient.colorMin = Color.white;
            //gradient.colorMax = virus.Value.Color;
            Gradient gradient = new Gradient();
            gradient.SetKeys(
                new GradientColorKey[]
            {
                new GradientColorKey(Color.white, 0.0f), new GradientColorKey(virus.Value.Color, 0.3f)
            },
                new GradientAlphaKey[]
            {
                new GradientAlphaKey(1.0f, 0.0f), new GradientAlphaKey(1.0f, 0.8f)    //, new GradientAlphaKey(0.0f, 1.0f)
            }
                );

            var col = hackParticles.colorOverLifetime;
            col.enabled = true;
            col.color   = gradient;

            hackParticles.Play();
        }
    }
Exemplo n.º 4
0
    private void CheckOccupationLimit(SystemElementController hackedElement, VirusValue virus)
    {
        float occupation = elementList.PercentageOccupation(virus.Value);

        if (occupation >= OccupationLimit)
        {
            onGameOver.Invoke();
        }
    }
Exemplo n.º 5
0
    public void OnElementDestroyed(SystemElementController elementController, VirusValue virus)
    {
        var element     = elementController.SystemElement;
        var control     = element.Control;
        int elementSize = element.Size;

        ElementsByControl[control].Remove(element);
        ControlElementSizes[control] -= elementSize;
        totalElementSize             -= elementSize;
    }
Exemplo n.º 6
0
 private void PlayDestroyEffect(SystemElementController systemElementController, VirusValue virus)
 {
     if (destroyParticles != null)
     {
         destroyParticles.transform.position = systemElementController.transform.position;
         //int elementSize = systemElementController.SystemElement.Size;
         //destroyParticles.transform.localScale.Set();
         destroyParticles.Play();
     }
 }
Exemplo n.º 7
0
 private void PlayAdd(SystemElementController systemElementController, VirusValue virus)
 {
     if (hack)
     {
         bonusText.text = "+" + systemElementController.SystemElement.HackReward;
     }
     else
     {
         bonusText.text = "+" + systemElementController.SystemElement.DestroyReward;
     }
     animator.SetTrigger(addAnimationId);
 }
Exemplo n.º 8
0
    private int PlayerNumber(VirusValue player)
    {
        int i = 0;

        for (i = 0; i < players.Length; i++)
        {
            if (players[i] == player.Value)
            {
                return(i + 1);
            }
        }
        return(i);
    }
    public OccupationCalculator(SystemElementList systemElementList, VirusValue virus)
    {
        this.systemElementList = systemElementList;
        this.virus             = virus;

        var controlSizes = systemElementList.ControlElementSizes;

        occupationDataList = new List <OccupationData>(controlSizes.Count);
        foreach (var control in controlSizes)
        {
            var occupationData = new OccupationData()
            {
                Control = control.Key
            };
            occupationDataList.Add(occupationData);
        }
    }
Exemplo n.º 10
0
 private void OnElementHacked(SystemElementController controller, VirusValue virus)
 {
     UpdateView();
 }
Exemplo n.º 11
0
 private void UpdateTextElement(SystemElementController systemElementController, VirusValue virus)
 {
     UpdateText();
 }
 public void OnElementHacked(SystemElementController controller, VirusValue virus)
 {
     pointsPerTurn.Value += controller.SystemElement.HackReward;
 }
Exemplo n.º 13
0
 public bool IsHackedBy(VirusValue virus)
 {
     return(IsHacked && OwnerVirus == virus.Value);
 }
Exemplo n.º 14
0
 public bool IsDestroyedBy(VirusValue virus)
 {
     return(IsDestroyed && OwnerVirus == virus.Value);
 }