Beispiel #1
0
 public CountUpModeScreen(CountUp countUp)
     : base(countUp)
 {
     GuiComponents.Add(new PointsPerDartComponent(countUp));
     GuiComponents.Add(new BigScoreComponent(countUp));
     GuiComponents.Add(new RoundScoresComponent(countUp));
 }
Beispiel #2
0
        public CricketModeScreen(Cricket cricket)
            : base(cricket)
        {
            GuiComponents.Add(new CricketMarksComponent(cricket));
            GuiComponents.Add(new CricketRoundMarksComponent(cricket));

            var dartScoreComponent = ((DartScoreComponent)GuiComponents.Find(x => x is DartScoreComponent));

            dartScoreComponent.Vertical = true;
            dartScoreComponent.Position = new Vector2(0.8f, 0.5f);

            GuiComponents.Remove(GuiComponents.Find(x => x is BigScoreComponent));
        }
Beispiel #3
0
        public BastardModeScreen(Bastard mode)
            : base(mode)
        {
            foreach (var p in mode.PlayerSegments)
            {
                _dartboard.ColorSegment(p.Key, Mode.GetPlayerColor(p.Value) * 0.33f);
            }

            var bigcoreComponent = ((BigScoreComponent)GuiComponents.Find(x => x is BigScoreComponent));

            bigcoreComponent.Position = new Vector2(0.33f, 0.33f);
            _dartboard.Scale          = 0.6f;
            _dartboard.Position       = new Vector2(0.66f, 0.33f);

            //GuiComponents.Add(new RoundScoresComponent(mode));
        }
Beispiel #4
0
    //===================================
    //===================================
    //		INITIALIZATION
    //===================================
    //===================================

    void Start()
    {
        // connect to external modules
        guiComponents   = GetComponent <GuiComponents>();
        levelManager    = GetComponent <LevelManager>();
        scoringSystem   = GetComponent <ScoringSystem>();
        inputControls   = GetComponent <InputControls>();
        overlayPanel    = GetComponent <OverlayPanel>();
        infoPanel       = GetComponent <InfoPanel>();
        feedingDisplay  = GetComponent <FeedingDisplay>();
        gameplayDisplay = GetComponent <GameplayDisplay>();

        // additional initialization
        SetGuiState("guiStateStartApp1");
        infoPanelVisible    = true;
        infoPanelTransStart = Time.time - 100000;
        customGUISkin.button.normal.textColor = new Color(0.90f, 0.65f, 0f, 1f);
        customGUISkin.button.hover.textColor  = new Color(0.99f, 0.75f, 0.21f, 1f);
    }
Beispiel #5
0
    //===================================
    //===================================
    //		INITIALIZATION
    //===================================
    //===================================

    void Start()
    {
        // connect to external modules
        guiManager    = GetComponent <GuiManager>();
        guiComponents = GetComponent <GuiComponents>();
        levelManager  = GetComponent <LevelManager>();
        scoringSystem = GetComponent <ScoringSystem>();

        // texture references from GuiManager
        buckHeadTexture = guiManager.buckHeadTexture;
        doeHeadTexture  = guiManager.doeHeadTexture;
        fawnHeadTexture = guiManager.fawnHeadTexture;
        closeup1Texture = guiManager.closeup1Texture;
        closeup2Texture = guiManager.closeup2Texture;
        closeup3Texture = guiManager.closeup3Texture;
        closeup4Texture = guiManager.closeup4Texture;
        closeup5Texture = guiManager.closeup5Texture;
        closeup6Texture = guiManager.closeup6Texture;
    }
    public bool ApplyAnimation(float time)
    {
        if (!_triggered)
        {
            var explosion = Object.Instantiate(GuiComponents.GetExplosionEffect());
            explosion.transform.position = _target.Position;             //+ GuiComponents.GetEffectHeightOffset();
            _triggered = true;
        }

        _elapsed     += time / GuiComponents.GetExplosionMotionTimeScale();
        _target.Scale = GuiComponents.GetExplosionMotion().Evaluate(_elapsed);

        if (_elapsed >= 1)
        {
            FMODUnity.RuntimeManager.PlayOneShot(destroySound, new Vector3(0, 0, 0));
            _target.Destroy();
            return(true);
        }
        return(false);
    }
Beispiel #7
0
    /// <summary>
    /// Links this Avatar to a Unit which it represents. This serves as a constructor in practice,
    /// moving this class from a template which defines a Unit, to a visual representation of it.
    /// </summary>
    /// <param name="unit">The Unit to link this too</param>
    public void SetUnit(Unit unit)
    {
        if (unit.Avatar != this)
        {
            throw new ArgumentException("Assigned Unit has a different Avatar");
        }
        if (_unit != null)
        {
            throw new ArgumentException("This Avatar has already been assigned a Unit");
        }

        _unit    = unit;
        Position = unit.Position.ToVector3();
        Rotation = unit.Facing.GetBearingRotation();

        // make UI elements
        _hpBar = Instantiate(GuiComponents.GetHpBar()).GetComponent <BarScript>();
        _epBar = Instantiate(GuiComponents.GetEpBar()).GetComponent <BarScript>();

        TeamColorPaint();
        //FMODUnity.RuntimeManager.PlayOneShot (inSound, Position);
    }
    public bool ApplyAnimation(float time)
    {
        if (!_impactTriggered && _projectile == null)
        {
            _unit.Scale = 0;
            _projectile = Object.Instantiate(GuiComponents.GetDeployProjectile());
            _projectile.transform.position = ProjectileOrigin + GuiComponents.GetEffectHeightOffset();
        }

        if (!_impactTriggered)          // first stage : entrace time
        {
            _projectile.transform.position = Vector3.Lerp(ProjectileOrigin, _unit.Position, _elapsed);
            _elapsed += time / GuiComponents.GetDeployEntranceTime();

            if (_elapsed >= 1)                  // set up for second stage
            {
                FMODUnity.RuntimeManager.PlayOneShot(deploySound, new Vector3(0, 0, 0));
                var smoke = Object.Instantiate(GuiComponents.GetDeployEffect());
                smoke.transform.position = _unit.Position;

                Object.Destroy(_projectile);

                _impactTriggered = true;
                _elapsed         = 0;
            }
        }
        else                                            // second stage : unit scale time
        {
            _unit.Scale = _elapsed;
            _elapsed   += time / GuiComponents.GetDeplotExitTime();

            if (_elapsed >= 1)
            {
                _unit.Scale = 1;
                return(true);
            }
        }
        return(false);
    }
Beispiel #9
0
    //===================================
    //===================================
    //		INITIALIZATION
    //===================================
    //===================================

    void Start()
    {
        // connect to external modules
        guiManager    = GetComponent <GuiManager>();
        guiComponents = GetComponent <GuiComponents>();
        guiUtils      = GetComponent <GuiUtils>();
        levelManager  = GetComponent <LevelManager>();
        inputControls = GetComponent <InputControls>();

        // texture references from GuiManager
        arrowTrayTexture      = guiManager.arrowTrayTexture;
        arrowTrayTopTexture   = guiManager.arrowTrayTopTexture;
        arrowUpTexture        = guiManager.arrowUpTexture;
        arrowDownTexture      = guiManager.arrowDownTexture;
        arrowLeftTexture      = guiManager.arrowLeftTexture;
        arrowRightTexture     = guiManager.arrowRightTexture;
        arrowTurnLeftTexture  = guiManager.arrowTurnLeftTexture;
        arrowTurnRightTexture = guiManager.arrowTurnRightTexture;
        indicatorBuck         = guiManager.indicatorBuck;
        indicatorDoe          = guiManager.indicatorDoe;
        indicatorFawn         = guiManager.indicatorFawn;
        indicatorBkgnd        = guiManager.indicatorBkgnd;
    }
Beispiel #10
0
 public ZeroOneModeScreen(ZeroOne zeroOne) : base(zeroOne)
 {
     GuiComponents.Add(new PointsPerDartComponent(zeroOne));
     GuiComponents.Add(new BigScoreComponent(zeroOne));
     GuiComponents.Add(new RoundScoresComponent(zeroOne));
 }
Beispiel #11
0
    public override bool ApplyAnimation(float time)
    {
        if (Sync())
        {
            if (_damage == 0)
            {
                return(true);                           // don't hit!
            }
            if (!_once)
            {
                FMODUnity.RuntimeManager.PlayOneShot(chargeSound, new Vector3(0, 0, 0));

                _once = true;
            }

            _animationTime += time / AttackTimeScale * Owner.MoveSpeed * 2;
            Owner.Position  = _startPos + _attackVector * AttackCurve.Evaluate(_animationTime);

            if (_animationTime >= ImpactTime && _impactStage >= 0)              // impact effects!
            {
                if (_impactEffect == null)
                {
                    FMODUnity.RuntimeManager.PlayOneShot(impactSound, new Vector3(0, 0, 0));
                    _impactEffect = Object.Instantiate(GuiComponents.GetImpactEffect());
                    _impactEffect.transform.position  = Owner.Position;
                    _impactEffect.transform.position += GuiComponents.GetEffectHeightOffset();
                }

                var   color     = Color.black;
                float flashTime = 0;
                switch (_impactStage)
                {
                case -1:
                    break;

                case 0:
                    Utils.Print("1");
                    color     = GuiComponents.GetHitPrimaryColor();
                    flashTime = GuiComponents.GetHitPrimaryTime();
                    break;

                case 1:
                    Utils.Print("2");
                    color     = GuiComponents.GetHitSecondaryColor();
                    flashTime = GuiComponents.GetHitSecondaryTime();
                    break;

                default:
                    Utils.Print("3");
                    Target.ResetPaint();
                    Target.Scale = 1;
                    Owner.UpdateEnergy(_attackerEnergy);
                    Target.UpdateHealth(_defenderHealth);
                    _impactStage = -1;
                    break;
                }
                if (_impactStage >= 0)
                {
                    Utils.Print("4");
                    Target.Paint(color);
                    Target.Scale = 1.1f;

                    _flashTime += time;
                    if (_flashTime > flashTime)
                    {
                        _impactStage++;
                        _flashTime = 0;
                    }
                }
            }
            if (_animationTime >= 1)
            {
                return(true);
            }
        }
        return(false);
    }
Beispiel #12
0
 // Use this for initialization
 private void Start()
 {
     _instance = this;
 }