Example #1
0
    public void DoAttack()
    {
        if (attackCooldown > 0)
        {
            return;
        }

        attackCooldown = WolfConfig.ATTACK_COOLDOWN;

        if (inputDirection.magnitude > 0.1f)
        {
            attackBeamAngle = Mathf.Atan2(-inputDirection.y, inputDirection.x) * RXMath.RTOD;
        }
        else
        {
            attackBeamAngle = player.isFacingLeft ? 180 : 0;
        }

        FXPlayer.WolfAttack();

        attackBeamAngle += 180;

        float   rads         = -attackBeamAngle * RXMath.DTOR + Mathf.PI;
        Vector2 attackVector = new Vector2(Mathf.Cos(rads), Mathf.Sin(rads));

        speed += attackVector * 7.0f;         //launch doggy

        isAttacking       = true;
        hasDoneAttackBeam = false;
        attackPercent     = 0;
    }
Example #2
0
    public FNode ShowButtonHighlight(FNode node, Vector2 offset, float width, float height, Color color, bool shouldPlaySound)
    {
        if (shouldPlaySound)
        {
            FXPlayer.NormalButtonTap();
        }

        FSliceSprite highlight = new FSliceSprite("UI/ButtonHighlight", width, height, 8, 8, 8, 8);

        AddChild(highlight);

        highlight.SetPosition(this.OtherToLocal(node, offset));

        highlight.shader = FShader.Additive;

        highlight.scale = 1.0f;
        highlight.alpha = 0.35f;
        highlight.color = color + new Color(0.5f, 0.5f, 0.5f);      //brighten the color

        //uniform scaling
        float growSize   = 8.0f;
        float growScaleX = (width + growSize) / width;
        float growScaleY = (height + growSize) / height;

        Go.to(highlight, 0.15f, new TweenConfig().floatProp("scaleX", growScaleX).floatProp("scaleY", growScaleY).floatProp("alpha", 0.0f).setEaseType(EaseType.Linear).removeWhenComplete());

        return(highlight);
    }
Example #3
0
 public void DoTap()
 {
     if (!_isEnabled && _canTapWhileDisabled)
     {
         if (shouldDoTapEffect)
         {
             this.effectManager.ShowButtonHighlight(this, Vector2.zero, button.width, button.height, _color.color);
         }
         if (SignalDisabledTap != null)
         {
             SignalDisabledTap(this);
         }
     }
     else if (!_isEnabled)
     {
         FXPlayer.DisabledButtonTap();
     }
     else
     {
         if (shouldDoTapEffect)
         {
             this.effectManager.ShowButtonHighlight(this, Vector2.zero, button.width, button.height, _color.color);
         }
         if (SignalTap != null)
         {
             SignalTap(this);
         }
     }
 }
Example #4
0
    void Start()
    {
        thisTransform = transform;
        fxPlayer      = GetComponent <FXPlayer>();

        //GameObject spawnedBar = Instantiate(energyBarPrefab) as GameObject;
        //spawnedBar.transform.parent = transform;
        //spawnedBar.transform.localPosition = new Vector3(0,1f,0);
        //energyBar = spawnedBar.GetComponent<DisplayBar>();
        //energyBar.DisplayValue = energy;

        attacker = GetComponent <Attacker>();
        attacker.OnTargetLeaveRange += targetLeftRange;
        attacker.OnTargetInRange    += targetInRange;
        attacker.OnTargetDeath      += targetDied;
        //attacker.OnBeginAttacking += startedAttacking;
        attacker.OnActualAttack += attack;

        navigator = GetComponent <Navigator>();
        if (navigator != null)
        {
            navigator.OnWalking   += walking;
            navigator.OnStartWalk += startWalking;
            navigator.OnStopWalk  += stopWalking;
        }
        life = GetComponent <Life>();
        life.OnBeingAttacked += wasAttacked;

        //StartCoroutine(energyRegen());
        SubscribeToInputDelegates();
    }
Example #5
0
    public void DestroyEnemy(GameObject enemy)
    {
        FXPlayer deathFX = Instantiate(enemy.GetComponent <Enemy>().GetDeathFX(), enemy.transform.position, enemy.transform.rotation, transform).GetComponent <FXPlayer>();

        deathFX.PlayFXes();

        Destroy(deathFX.gameObject, 3.0f);

        OnDestroyCommand(enemy);
    }
Example #6
0
    void Update()
    {
        bool didTeamChange       = false;
        bool didPlayerPressStart = false;

        foreach (var row in rows)
        {
            var  player  = row.player;
            Team newTeam = null;

            if (player.team.teamToTheLeft != null && player.device.LeftStick.Left.WasPressed)
            {
                newTeam = player.team.teamToTheLeft;
            }
            else if (player.team.teamToTheRight != null && player.device.LeftStick.Right.WasPressed)
            {
                newTeam = player.team.teamToTheRight;
            }

            if (newTeam != null)
            {
                player.team = newTeam;
                TeamCol col = GetColForTeam(newTeam);
                Go.killAllTweensWithTarget(row.inner);
                Go.to(row.inner, 0.3f, new TweenConfig().x(col.x).expoOut());
                didTeamChange = true;

                if (newTeam == PlayerManager.Team_Villagers)
                {
                    FXPlayer.VillAttack();
                }
                else if (newTeam == PlayerManager.Team_Wolves)
                {
                    FXPlayer.WolfAttack();
                }
            }

            if (player.device.MenuWasPressed)
            {
                didPlayerPressStart = true;
            }
        }

        if (didTeamChange)
        {
            CheckStatus();
        }

        if (isReady && didPlayerPressStart)
        {
            StartGame();
        }
    }
Example #7
0
    void Die()
    {
        if (isDead)
        {
            return;
        }

        isDead = true;

        FXPlayer.WolfDeath();

        player.OnHumanDeath(this);
    }
Example #8
0
    void Die()
    {
        if (isDead)
        {
            return;
        }

        isDead = true;

        FXPlayer.VillDeath();

        RemoveFromArea();
    }
Example #9
0
    private void Awake()
    {
        Instance = this;

        fxPools = new FXPool[config.fxs.Length];
        for (int i = 0; i < config.fxs.Length; i++)
        {
            GameObject newPoolGO = new GameObject("FXPool_" + config.fxs[i].fxName);
            newPoolGO.transform.parent = transform;
            FXPool newPool = newPoolGO.AddComponent <FXPool>();
            newPool.Initialize(config.fxs[i]);
            fxPools[i] = newPool;
        }
    }
Example #10
0
    void GoNight()
    {
        isDay = false;

        ShowMessage("NIGHT HAS COME!", "CHASE THE VILLAGERS!", new Color(0.9f, 0.95f, 1f));

        Go.killAllTweensWithTarget(arena.colorOverlay);
        Go.to(arena.colorOverlay, Config.DAY_TRANSITION_DURATION, new TweenConfig().colorProp("color", new Color(0, 0.03f, 0.18f, 0.5f)));

        foreach (var human in arena.humans)
        {
            human.TransformIntoWolf();
        }

        FXPlayer.NightStart();
    }
Example #11
0
    void GoDay()
    {
        isDay = true;

        ShowMessage("DAY IS HERE!", "CHASE THE WEREWOLF!", new Color(1f, 1f, 0.9f));

        Go.killAllTweensWithTarget(arena.colorOverlay);
        Go.to(arena.colorOverlay, Config.DAY_TRANSITION_DURATION, new TweenConfig().colorProp("color", new Color(0, 0, 0, 0.0f)));

        for (int w = arena.wolves.Count - 1; w >= 0; w--)    //reversed for removals
        {
            var wolf = arena.wolves[w];
            wolf.TransformIntoHuman();
        }

        FXPlayer.DayStart();
    }
    void Start()
    {
        Time.timeScale = 1f;
        gameState      = GameState.Playing;
        playerFaction  = spawnedPlayer.GetComponent <Targetable>().faction;
        fxPlayer       = GetComponent <FXPlayer>();
        gameUI         = GetComponent <GameUI>();

        if (isTimed)
        {
            InvokeRepeating("roundTimeCountdown", 1, 1);
        }

        //spawnCoins(50, new Vector3(-1, 4, 8));

        IntersceneData.instance.ApplyEquipment(spawnedPlayer);
    }
Example #13
0
    public Core()
    {
        instance = this;

        AddChild(pageContainer    = new FContainer());
        AddChild(topEffectManager = new EffectManager(true));

        audioManager        = new AudioManager();
        FXPlayer.manager    = audioManager.fxManager;
        MusicPlayer.manager = audioManager.musicManager;
        FXPlayer.Preload();

        playerManager = new PlayerManager();

        playerManager.Setup();

        ShowPage(new PlayerSelectPage());

        ListenForUpdate(Update);
    }
Example #14
0
    void ShowGameOver(bool didWolfWin)
    {
        isGameOver = true;
        GameOverScreen goScreen = new GameOverScreen(didWolfWin);

        Debug.Log("Game over! wolf won?" + didWolfWin);

        if (didWolfWin)
        {
            FXPlayer.WolfWin();
        }
        else
        {
            FXPlayer.VillWin();
        }

        AddChild(goScreen);
        goScreen.alpha = 0.0f;
        goScreen.scale = 0.4f;
        Go.to(goScreen, 0.5f, new TweenConfig().alpha(1.0f).setDelay(0.5f));
        Go.to(goScreen, 0.5f, new TweenConfig().scaleXY(1.0f).setDelay(0.5f).backOut());
    }
Example #15
0
    void DoAttack(Human human)
    {
        float dx = x - human.x;
        float dy = y - human.y;

        float attackBeamAngle = Mathf.Atan2(dy, dx) * RXMath.RTOD;

        pushSpeed -= new Vector2(dx, dy).normalized;        //move towards human

        var attackBeam = new VillAttackBeam(this, attackBeamAngle);

        float   beamDist = 5;
        float   rads     = -attackBeamAngle * RXMath.DTOR + Mathf.PI;
        Vector2 offset   = new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * beamDist;

        attackBeam.x = x + offset.x;
        attackBeam.y = y + 6 + offset.y;

        attackBeam.AddToArea();
        attackBeam.Update();

        FXPlayer.VillAttack();
    }
Example #16
0
 protected override void Start()
 {
     base.Start();
     fxPlayer = GetComponent <FXPlayer>();
 }
Example #17
0
 private void Awake()
 {
     Instance = this;
 }
 protected override void Start()
 {
     base.Start ();
     fxPlayer = GetComponent<FXPlayer>();
 }
    void Start()
    {
        Time.timeScale = 1f;
        gameState = GameState.Playing;
        playerFaction = spawnedPlayer.GetComponent<Targetable>().faction;
        fxPlayer = GetComponent<FXPlayer>();
        gameUI = GetComponent<GameUI>();

        if(isTimed)
            InvokeRepeating("roundTimeCountdown", 1, 1);

        //spawnCoins(50, new Vector3(-1, 4, 8));

        IntersceneData.instance.ApplyEquipment(spawnedPlayer);
    }
Example #20
0
    void Start()
    {
        thisTransform = transform;
        fxPlayer = GetComponent<FXPlayer>();

        //GameObject spawnedBar = Instantiate(energyBarPrefab) as GameObject;
        //spawnedBar.transform.parent = transform;
        //spawnedBar.transform.localPosition = new Vector3(0,1f,0);
        //energyBar = spawnedBar.GetComponent<DisplayBar>();
        //energyBar.DisplayValue = energy;

        attacker = GetComponent<Attacker>();
        attacker.OnTargetLeaveRange += targetLeftRange;
        attacker.OnTargetInRange += targetInRange;
        attacker.OnTargetDeath += targetDied;
        //attacker.OnBeginAttacking += startedAttacking;
        attacker.OnActualAttack += attack;

        navigator = GetComponent<Navigator>();
        if(navigator != null)
        {
            navigator.OnWalking += walking;
            navigator.OnStartWalk += startWalking;
            navigator.OnStopWalk += stopWalking;
        }
        life = GetComponent<Life>();
        life.OnBeingAttacked += wasAttacked;

        //StartCoroutine(energyRegen());
        SubscribeToInputDelegates();
    }
Example #21
0
 void Start()
 {
     playerTag = GetComponent <PlayerTag> ();
     fxPlayer  = GetComponent <FXPlayer> ();
 }