void Start()
    {
        Renderers = GetComponentsInChildren <Renderer>();
        GlowController.RegisterObject(this);

        relatedBridge.AddRange(GameObject.FindGameObjectsWithTag("RotatingBridge"));
    }
Ejemplo n.º 2
0
    void BecomeAKeeper()
    {
        toSubscribe.OnQuestComplete -= BecomeAKeeper;
        PawnInstance pawn = GameManager.Instance.PawnDataBase.CreatePawn(idKeeper, transform.position, transform.rotation, null).GetComponent <PawnInstance>();

        GameManager.Instance.PersistenceLoader.SetPawnUnlocked(idKeeper, true);
        if (GameManager.Instance.PersistenceLoader.Pd.dicPersistencePawns.ContainsKey(idKeeper))
        {
            GameManager.Instance.PersistenceLoader.Pd.dicPersistencePawns[idKeeper] = true;
        }
        GameManager.Instance.PawnDataBase.InitPawn(pawn);
        GameManager.Instance.AllKeepersList.Add(pawn);
        GameManager.Instance.CharacterInitializer.InitCharacterUI(pawn);
        TileManager.Instance.AddKeeperOnTile(GetComponentInParent <Tile>(), pawn);
        GameManager.Instance.GetFirstSelectedKeeper().GetComponent <Behaviour.Keeper>().IsSelected = false;
        GameManager.Instance.ClearListKeeperSelected();
        pawn.GetComponent <Behaviour.Keeper>().IsSelected = true;
        GameManager.Instance.AddKeeperToSelectedList(pawn);
        GlowController.RegisterObject(pawn.GetComponent <GlowObjectCmd>());
        pawn.GetComponent <UnityEngine.AI.NavMeshAgent>().enabled = true;
        Transform feed = GetComponent <Interactable>().Feedback;

        feed.GetChild(feed.childCount - 1).SetParent(GameManager.Instance.Ui.transform);
        GameManager.Instance.PersistenceLoader.SetPawnUnlocked(idKeeper, true);
        DestroyImmediate(gameObject);
    }
Ejemplo n.º 3
0
 void Start()
 {
     GlowColor          = Color.yellow;
     distanceFromPlayer = 2;
     girl      = GameObject.Find("Girl").transform;
     boi       = GameObject.Find("Boi").transform;
     Renderers = GetComponentsInChildren <Renderer>();
     GlowController.RegisterObject(this);
 }
Ejemplo n.º 4
0
    private void ExitBattleStateProcess()
    {
        foreach (NavMeshAgent agent in pausedAgents)
        {
            if (agent != null && agent.isActiveAndEnabled)
            {
                agent.Resume();
            }
        }
        pausedAgents.Clear();

        foreach (GameObject go in disabledModels)
        {
            go.SetActive(true);
        }
        disabledModels.Clear();

        foreach (GlowObjectCmd goc in unregisteredGlows)
        {
            GlowController.RegisterObject(goc);
        }
        unregisteredGlows.Clear();

        // Prevents monster agression when returning to normal state
        foreach (PawnInstance pi in tileManagerReference.KeepersOnTile[ActiveTile])
        {
            if (pi.GetComponent <Fighter>() != null)
            {
                pi.GetComponent <Fighter>().IsTargetableByMonster = false;
            }
        }
        if (prisonerInstance.CurrentTile == ActiveTile)
        {
            if (prisonerInstance.GetComponent <Fighter>() != null)
            {
                prisonerInstance.GetComponent <Fighter>().IsTargetableByMonster = false;
            }
        }

        // Reactivate tile portals
        foreach (GameObject go in tilePortalsDisabled)
        {
            go.SetActive(true);
        }
        tilePortalsDisabled.Clear();

        // Enable quest reminder button
        gameScreens.transform.GetChild(0).GetChild((int)IngameScreensEnum.QuestReminderButton).gameObject.SetActive(true);

        cameraManagerReference.UpdateCameraPositionExitBattle();
        if (hasLost)
        {
            Lose();
        }
    }
Ejemplo n.º 5
0
    void Start()
    {
        Renderers = GetComponentsInChildren <Renderer>();
        GlowController.RegisterObject(this);
        persistanceObj = GameObject.Find("/PersistenceManager");

        if (persistanceObj == null)
        {
            byPass = true;
        }
        else
        {
            persistance = persistanceObj.GetComponent <PersistenceManager>();
        }
    }
Ejemplo n.º 6
0
    private void SelectCurrentObject(IInteractableObject obj)
    {
        CurrentObject            = obj;
        CurrentObject.IsSelected = true;

        var position  = obj.transform.position;
        var direction = (obj.transform.position - headTransf.position).normalized;

        //m_charBeh.m_characterAnimation.SetLookingPoint(direction, 0.5f);
        //m_charBeh.m_characterAnimation.SetRightHandIK(obj.transform.position, 0.3f);

        foreach (var rend in obj.m_renderers)
        {
            //HighlightsImageEffect.Instance.OnObjectMouseOver(obj.m_renderer, Color.white);
            GlowController.RegisterObject(rend);
        }
    }
Ejemplo n.º 7
0
    void Start()
    {
        Renderer[]      rendererers = GetComponentsInChildren <Renderer>();
        List <Renderer> rends       = new List <Renderer>();

        foreach (Renderer r in rendererers)
        {
            if (r.GetComponent <ParticleSystem>() == null)
            {
                rends.Add(r);
            }
        }
        Renderers = rends.ToArray();
        if ((GetComponent <Monster>() != null && GetComponent <ItemInstance>() != null) || GetComponent <Monster>() == null)
        {
            GlowController.RegisterObject(this);
        }
    }
Ejemplo n.º 8
0
 private void Update()
 {
     if (!_currentColor.Equals(GlowColor))
     {
         _currentColor = GlowColor;
     }
     if (prevEnableGlow != enableGlow)
     {
         prevEnableGlow = enableGlow;
         if (enableGlow)
         {
             _currentColor = GlowColor;
             GlowController.RegisterObject(this);
         }
         else
         {
             _currentColor = Color.black;
             GlowController.DeleteObject(this);
         }
     }
 }
Ejemplo n.º 9
0
    // Init keepers and call next initialization
    public void InitKeepers(Transform[] beginPositionsKeepers)
    {
        GameManager.Instance.AllKeepersList.Clear();

        for (int i = 0; i < GameManager.Instance.AllKeeperListId.Count; i++)
        {
            string     curKeeperStr = GameManager.Instance.AllKeeperListId[i];
            GameObject curKeeper    = GameManager.Instance.PawnDataBase.CreatePawn(curKeeperStr, beginPositionsKeepers[i].position, Quaternion.identity, null);
            curKeeper.transform.localScale = Vector3.one;
            curKeeper.transform.GetComponent <NavMeshAgent>().enabled = true;
            PawnInstance curKeeperPI = curKeeper.transform.GetComponent <PawnInstance>();
            if (curKeeperPI.Data.Behaviours[(int)BehavioursEnum.Archer] == true)
            {
                GameManager.Instance.ArcherInstance = curKeeperPI;
            }

            GameManager.Instance.AllKeepersList.Add(curKeeperPI);
            InitCharacterUI(curKeeperPI);
            GameManager.Instance.RegisterKeeperPosition(curKeeperPI);
            GlowController.RegisterObject(curKeeperPI.GetComponent <GlowObjectCmd>());
        }

        // Next step, init quests
        // TODO: init quests

        // Next step, init NPCs
        // TODO: init quests and call this properly
        if (TutoManager.s_instance != null)
        {
            TutoManager.s_instance.InitDataTuto();
        }
        InitNPCs();
        if (TutoManager.s_instance != null)
        {
            TutoManager.s_instance.InitTuto();
        }

        EventManager.HandleWeather();
    }
Ejemplo n.º 10
0
 public void Bite()
 {
     GlowController.RegisterObject(menuManager.GetComponent <BoxOpener>().boxLock.GetComponent <GlowObjectCmd>());
     menuManager.DuckhavebringThebox = true;
 }
Ejemplo n.º 11
0
    private void SwitchToBattleStateProcess()
    {
        // Pause keepers
        foreach (PawnInstance pi in allKeepersList)
        {
            bool mustBeDisabled = false;
            for (int i = 0; i < currentFighters.Length && i < 3; i++)
            {
                if (pi == currentFighters[i])
                {
                    mustBeDisabled = true;
                }
            }

            if (mustBeDisabled)
            {
                pi.GetComponent <NavMeshAgent>().enabled = false;
            }
            else
            {
                NavMeshAgent currentAgent = pi.GetComponent <NavMeshAgent>();
                if (currentAgent != null && currentAgent.isActiveAndEnabled)
                {
                    currentAgent.Stop();
                    pausedAgents.Add(currentAgent);
                    pi.transform.GetChild(0).gameObject.SetActive(false);
                    disabledModels.Add(pi.transform.GetChild(0).gameObject);
                    if (pi.GetComponent <GlowObjectCmd>() != null)
                    {
                        GlowController.UnregisterObject(pi.GetComponent <GlowObjectCmd>());
                        unregisteredGlows.Add(pi.GetComponent <GlowObjectCmd>());
                    }
                }
            }

            pi.GetComponent <Keeper>().ShowSelectedPanelUI(false);
            ui.ClearActionPanel();
            ui.HideInventoryPanels();
        }

        // Pause NPCs
        // If needed, we should register all PNJ on tiles in TileManager so we can handle AI behaviours when the game paused
        // For now we'll only deal with the prisoner
        if (currentFighters[currentFighters.Length - 1].GetComponent <Prisoner>() != null)
        {
            NavMeshAgent prisonerAgent = currentFighters[currentFighters.Length - 1].GetComponent <NavMeshAgent>();
            if (prisonerAgent != null && prisonerAgent.isActiveAndEnabled)
            {
                prisonerAgent.enabled = false;
            }
        }
        else
        {
            if (prisonerInstance != null)
            {
                NavMeshAgent prisonerAgent = prisonerInstance.GetComponent <NavMeshAgent>();
                if (prisonerAgent != null && prisonerAgent.isActiveAndEnabled)
                {
                    prisonerAgent.Stop();
                    pausedAgents.Add(prisonerAgent);
                }
            }
        }

        // Pause monsters
        foreach (Tile tile in tileManagerReference.MonstersOnTile.Keys)
        {
            if (tile != cameraManagerReference.ActiveTile)
            {
                List <PawnInstance> monsterList = tileManagerReference.MonstersOnTile[tile];
                foreach (PawnInstance pi in monsterList)
                {
                    NavMeshAgent currentAgent = pi.GetComponent <NavMeshAgent>();
                    if (currentAgent != null && currentAgent.isActiveAndEnabled)
                    {
                        currentAgent.Stop();
                        pausedAgents.Add(currentAgent);
                    }
                }
            }
            else
            {
                List <PawnInstance> monsterList = tileManagerReference.MonstersOnTile[tile];
                foreach (PawnInstance pi in monsterList)
                {
                    NavMeshAgent currentAgent = pi.GetComponent <NavMeshAgent>();
                    if (currentAgent != null)
                    {
                        pi.GetComponent <AnimatedPawn>().WasAgentActiveBeforeBattle = currentAgent.isActiveAndEnabled;
                        if (currentAgent.isActiveAndEnabled)
                        {
                            currentAgent.enabled = false;
                        }
                    }
                    if (pi.GetComponent <GlowObjectCmd>() != null)
                    {
                        GlowController.RegisterObject(pi.GetComponent <GlowObjectCmd>());
                    }

                    if (pi.GetComponentInChildren <AggroBehaviour>() != null)
                    {
                        pi.GetComponentInChildren <AggroBehaviour>().gameObject.SetActive(false);
                    }
                }
            }
        }

        // Mask tile portals
        Transform tilePortals = currentFighters[0].CurrentTile.transform.GetChild(0).GetChild((int)TilePrefabChildren.PortalTriggers);

        for (int i = 0; i < tilePortals.childCount; i++)
        {
            if (tilePortals.GetChild(i).gameObject.activeSelf)
            {
                tilePortalsDisabled.Add(tilePortals.GetChild(i).gameObject);
                tilePortals.GetChild(i).gameObject.SetActive(false);
            }
        }

        // Mask quest reminder button
        gameScreens.transform.GetChild(0).GetChild((int)IngameScreensEnum.QuestReminderButton).gameObject.SetActive(false);

        Transform tileModel = ActiveTile.transform.GetChild(0).GetChild((int)TilePrefabChildren.Model);

        for (int i = 0; i < tileModel.childCount; i++)
        {
            if (tileModel.GetChild(i).name.Equals("Center"))
            {
                tileModel.GetChild(i).gameObject.SetActive(false);
                disabledModels.Add(tileModel.GetChild(i).gameObject);
            }
        }

        PawnInstance[] toDisable = ActiveTile.GetComponentsInChildren <PawnInstance>();
        foreach (PawnInstance pi in toDisable)
        {
            if (pi.GetComponent <Monster>() == null)
            {
                pi.gameObject.SetActive(false);
                disabledModels.Add(pi.gameObject);
            }
        }

        LootInstance[] lootToDisable = ActiveTile.GetComponentsInChildren <LootInstance>();
        foreach (LootInstance li in lootToDisable)
        {
            li.gameObject.SetActive(false);
            disabledModels.Add(li.gameObject);
        }

        // Make escortable disappear
        if (TileManager.Instance.EscortablesOnTile.ContainsKey(ActiveTile))
        {
            foreach (PawnInstance pi in TileManager.Instance.EscortablesOnTile[ActiveTile])
            {
                pi.gameObject.SetActive(false);
                disabledModels.Add(pi.gameObject);
            }
        }

        // Hide item instance
        for (int i = 1; i < ActiveTile.transform.childCount; i++)
        {
            ItemInstance curItem = ActiveTile.transform.GetChild(i).GetComponentInChildren <ItemInstance>();
            if (curItem != null)
            {
                curItem.transform.parent.gameObject.SetActive(false);
                disabledModels.Add(curItem.transform.parent.gameObject);
            }
        }

        Ui.GoActionPanelQ.transform.parent.SetParent(Ui.transform);
    }
Ejemplo n.º 12
0
 void Start()
 {
     Renderers = GetComponentsInChildren <Renderer>();
     GlowController.RegisterObject(this);
 }
Ejemplo n.º 13
0
    private void InitNPCs()
    {
        foreach (Quest quest in GameManager.Instance.QuestManager.Quests)
        {
            if (quest.Identifier.SourceID != string.Empty)
            {
                if (GameManager.Instance.QuestSources == null)
                {
                    break;
                }
                QuestSource source = GameManager.Instance.QuestSources.FindSourceByID(quest.Identifier.SourceID);
                if (source == null)
                {
                    Debug.Log("Can't spawn NPC \"" + quest.Identifier.SourceID + "\". No QuestSource with this ID found in the scene.");
                }
                else
                {
                    if (source.needsToBeSpawned)
                    {
                        GameObject spawnedPawn = GameManager.Instance.PawnDataBase.CreatePawn(source.ID, source.Transform.position, source.Transform.rotation, null);
                        // TODO: NPCs must be registered in Tile Manager and ComputeItems called in character initializer
                        if (spawnedPawn.GetComponent <PawnInstance>() != null && spawnedPawn.GetComponent <Keeper>() == null)
                        {
                            if (spawnedPawn.GetComponent <Inventory>() != null && spawnedPawn.GetComponent <Inventory>().PossibleItems != null && spawnedPawn.GetComponent <Inventory>().PossibleItems.Count > 0)
                            {
                                spawnedPawn.GetComponent <Inventory>().ComputeItems();
                            }
                        }
                        spawnedPawn.transform.SetParent(source.Tile.transform);
                        spawnedPawn.transform.SetAsLastSibling();
                        spawnedPawn.GetComponent <PawnInstance>().CurrentTile          = source.Tile;
                        spawnedPawn.GetComponent <Behaviour.QuestDealer>().QuestToGive = quest;
                        spawnedPawn.GetComponent <Behaviour.QuestDealer>().Init();
                        InitCharacterUI(spawnedPawn.GetComponent <PawnInstance>());
                        if (source.Tile.State != TileState.Discovered)
                        {
                            spawnedPawn.SetActive(false);
                        }
                    }
                    else
                    {
                        source.Transform.GetComponent <Behaviour.QuestDealer>().QuestToGive = quest;
                        source.Transform.GetComponent <Behaviour.QuestDealer>().Init();
                    }
                }
            }
        }

        foreach (Tile t in TileManager.Instance.Tiles.GetComponentsInChildren <Tile>())
        {
            if (GetComponentsInChildren <Trader>() != null)
            {
                for (int i = 0; i < t.transform.childCount; i++)
                {
                    if (t.transform.GetChild(i).GetComponent <Trader>() != null)
                    {
                        Trader ta = t.transform.GetChild(i).GetComponent <Trader>();
                        if (ta.GetComponent <Inventory>() != null && ta.GetComponent <Inventory>().PossibleItems != null && ta.GetComponent <Inventory>().PossibleItems.Count > 0)
                        {
                            ta.GetComponent <Inventory>().ComputeItems();
                        }

                        ta.GetComponent <PawnInstance>().CurrentTile = t;
                        InitCharacterUI(ta.GetComponent <PawnInstance>());
                    }
                }
            }

            if (GetComponentsInChildren <HintWoman>() != null)
            {
                for (int i = 0; i < t.transform.childCount; i++)
                {
                    if (t.transform.GetChild(i).GetComponent <HintWoman>() != null)
                    {
                        HintWoman ta = t.transform.GetChild(i).GetComponent <HintWoman>();
                        ta.GetComponent <PawnInstance>().CurrentTile = t;
                    }
                }
            }
        }

        // TODO this should not be handled like, especially if there is more prisoner in scene
        GameObject prisoner = GameManager.Instance.PawnDataBase.CreatePawn("ashley", TileManager.Instance.BeginTile.transform.position, Quaternion.identity, null);

        GlowController.RegisterObject(prisoner.GetComponent <GlowObjectCmd>()); // TODO: Inutile maintenant ?

        InitCharacterUI(prisoner.GetComponent <PawnInstance>());
        GameManager.Instance.PrisonerInstance = prisoner.GetComponent <PawnInstance>();
        if (GameManager.Instance.QuestManager.CurrentQuestDeck != null)
        {
            switch (GameManager.Instance.QuestManager.CurrentQuestDeck.LevelId)
            {
            case "tuto":
                GameManager.Instance.QuestSources.GetComponent <QuestInitializer_Level1>().InitializeQuests();
                break;

            case "level1":
                GameManager.Instance.QuestSources.GetComponent <QuestInitializer_Level1>().InitializeQuests();
                break;

            case "level2":
                GameManager.Instance.QuestSources.GetComponent <QuestInitializer_Level2>().InitializeQuests();
                break;

            case "level3":
                GameManager.Instance.QuestSources.GetComponent <QuestInitializer_Level3>().InitializeQuests();
                break;

            case "level4":
                GameManager.Instance.QuestSources.GetComponent <QuestInitializer_Level4>().InitializeQuests();
                break;

            default:
                break;
            }
            //GameManager.Instance.QuestSources.GetComponent<QuestInitializer>().InitializeQuests();
            GameManager.Instance.QuestManager.MainQuest.OnQuestComplete += EndGameQuest;
        }
        else
        {
            Debug.Log("No deck loaded");
        }
    }
Ejemplo n.º 14
0
    public void UpdateCardLevelSelectedPosition()
    {
        if (carLevelSelectedfLerp == 0 && !levelCardSelected.GetComponent <CardLevel>().IsSelected&& indexCardSelected == 0)
        {
            GlowController.UnregisterObject(levelCardSelected.GetComponent <GlowObjectCmd>());
            for (int i = 0; i < menuManager.GoCardChildren.Count; i++)
            {
                for (int j = 0; j < menuManager.GoCardChildren[i].Count; j++)
                {
                    menuManager.GoCardChildren[i][j].SetActive(false);
                    menuManager.GoCardChildren[i][j].transform.localPosition = Vector3.zero;
                }
            }
        }



        carLevelSelectedfLerp += Time.unscaledDeltaTime * 4f;


        if (carLevelSelectedfLerp > 1)
        {
            carLevelSelectedfLerp = 1;
        }

        if (levelCardSelected.GetComponent <CardLevel>().IsSelected)
        {
            Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().bloomIntensity = 0.35f + (carLevelSelectedfLerp * 0.65f);
            Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().sepBlurSpread  = 0.1f + (carLevelSelectedfLerp * 1.4f);


            levelCardSelected.transform.position = Vector3.Lerp(cameraWhere.position, levelCardSelectedPosition.position, carLevelSelectedfLerp);
            levelCardSelected.transform.rotation = Quaternion.Lerp(cameraWhere.rotation, levelCardSelectedPosition.rotation, carLevelSelectedfLerp);
        }
        else
        {
            if (indexCardSelected == 2)
            {
                levelCardSelected.transform.position = Vector3.Lerp(levelCardKeyPoses[0][1].v3Pos, levelCardKeyPoses[0][0].v3Pos, carLevelSelectedfLerp);
                levelCardSelected.transform.rotation = Quaternion.Lerp(levelCardKeyPoses[0][1].quatRot, levelCardKeyPoses[0][0].quatRot, carLevelSelectedfLerp);
            }
            else if (indexCardSelected == 1)
            {
                levelCardSelected.transform.position = Vector3.Lerp(levelCardSelectedPosition2.position, levelCardKeyPoses[0][1].v3Pos, carLevelSelectedfLerp);
                levelCardSelected.transform.rotation = Quaternion.Lerp(levelCardSelectedPosition2.rotation, levelCardKeyPoses[0][1].quatRot, carLevelSelectedfLerp);
            }
            else
            {
                levelCardSelected.transform.position = Vector3.Lerp(levelCardSelectedPosition.position, levelCardSelectedPosition2.position, carLevelSelectedfLerp);
                levelCardSelected.transform.rotation = Quaternion.Lerp(levelCardSelectedPosition.rotation, levelCardSelectedPosition2.rotation, carLevelSelectedfLerp);
            }
        }


        if (carLevelSelectedfLerp == 1)
        {
            if (levelCardSelected.GetComponent <CardLevel>().IsSelected)
            {
                for (int i = 0; i < menuManager.GoCardChildren.Count; i++)
                {
                    for (int j = 0; j < menuManager.GoCardChildren[i].Count; j++)
                    {
                        if (levelCardSelected == menuManager.GoCardChildren[i][j].GetComponentInParent <CardLevel>().gameObject)
                        {
                            menuManager.GoCardChildren[i][j].SetActive(true);
                            menuManager.GoCardChildren[i][j].transform.localPosition = new Vector3(0.1f, -0.01f, 0.0f) * (j + 1);
                        }
                        else
                        {
                            menuManager.GoCardChildren[i][j].SetActive(false);
                            menuManager.GoCardChildren[i][j].transform.localPosition = Vector3.zero;
                        }
                    }
                }

                for (int i = 0; i < GameManager.Instance.AllKeepersList.Count; i++)
                {
                    GlowController.RegisterObject(GameManager.Instance.AllKeepersList[i].GetComponent <GlowObjectCmd>());
                }
                for (int i = 0; i < menuManager.GoCardsInfo.Count; i++)
                {
                    GlowController.RegisterObject(menuManager.GoCardsInfo[i].GetComponentInChildren <GlowObjectCmd>());
                }
            }
            else
            {
                if (indexCardSelected == 2)
                {
                    levelCardSelected = null;
                    for (int i = 0; i < GameManager.Instance.AllKeepersList.Count; i++)
                    {
                        GlowController.UnregisterObject(GameManager.Instance.AllKeepersList[i].GetComponent <GlowObjectCmd>());
                    }
                    for (int i = 0; i < menuManager.GoCardsInfo.Count; i++)
                    {
                        GlowController.UnregisterObject(menuManager.GoCardsInfo[i].GetComponentInChildren <GlowObjectCmd>());
                    }
                }
            }

            //box.UpdateLockAspect();
            if (levelCardSelected != null && levelCardSelected.GetComponent <CardLevel>().IsSelected)
            {
                aCardLevelSelectedIsMoving = false;
            }
            else if (indexCardSelected != 2)
            {
                indexCardSelected++;
            }
            else if (indexCardSelected == 2)
            {
                aCardLevelSelectedIsMoving = false;
            }
            carLevelSelectedfLerp = 0;


            if (!initCardInfo)
            {
                initCardInfo = true;
            }
        }
    }
Ejemplo n.º 15
0
    public void UpdateCardInfoShowingPositions()
    {
        if (cardInfoShownfLerp == 0)
        {
            for (int i = 0; i < menuManager.GoCardsInfo.Count; i++)
            {
                if (menuManager.GoCardsInfo[i].GetComponentInChildren <Displayer>().NeedToBeShown)
                {
                    GlowController.RegisterObject((menuManager.GoCardsInfo[i].GetComponentInChildren <GlowObjectCmd>()));
                }
                else
                {
                    GlowController.UnregisterObject((menuManager.GoCardsInfo[i].GetComponentInChildren <GlowObjectCmd>()));
                }
            }

            menuManager.SetActiveChatBoxes(false);
        }

        cardInfoShownfLerp += Time.unscaledDeltaTime * 10f;

        if (cardInfoShownfLerp > 1)
        {
            cardInfoShownfLerp = 1;
        }


        for (int i = 0; i < menuManager.GoCardsInfo.Count; i++)
        {
            if (menuManager.GoCardsInfo[i].GetComponentInChildren <Displayer>().NeedToBeShown)
            {
                Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().bloomIntensity = 1f - (cardInfoShownfLerp * 0.65f);
                Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().sepBlurSpread  = 1.5f - (cardInfoShownfLerp * 1.4f);

                menuManager.GoCardsInfo[i].transform.position = Vector3.Lerp(levelCardInfoKeyPoses[i][levelCardInfoKeyPoses[i].Count - 1].v3Pos, cameraWhere.transform.position + new Vector3(0, 0.5f, -0.2f), cardInfoShownfLerp);
                menuManager.GoCardsInfo[i].transform.rotation = Quaternion.Lerp(levelCardInfoKeyPoses[i][levelCardInfoKeyPoses[i].Count - 1].quatRot, cameraWhere.transform.rotation, cardInfoShownfLerp);
            }
            else if (ACardInfoIsShown)
            {
                if (menuManager.GoCardsInfo[i].GetComponentInChildren <Displayer>().IsShown)
                {
                    Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().bloomIntensity = 0.35f + (cardInfoShownfLerp * 0.65f);
                    Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().sepBlurSpread  = 0.1f + (cardInfoShownfLerp * 1.4f);

                    menuManager.GoCardsInfo[i].transform.position = Vector3.Lerp(cameraWhere.transform.position + new Vector3(0, 0.5f, -0.2f), levelCardInfoKeyPoses[i][levelCardInfoKeyPoses[i].Count - 1].v3Pos, cardInfoShownfLerp);
                    menuManager.GoCardsInfo[i].transform.rotation = Quaternion.Lerp(cameraWhere.transform.rotation, levelCardInfoKeyPoses[i][levelCardInfoKeyPoses[i].Count - 1].quatRot, cardInfoShownfLerp);
                }
            }
        }


        if (cardInfoShownfLerp == 1)
        {
            isACardInfoMovingForShowing = false;
            cardInfoShownfLerp          = 0;



            bool isACardShow = false;
            for (int i = 0; i < menuManager.GoCardsInfo.Count; i++)
            {
                if (menuManager.GoCardsInfo[i].GetComponentInChildren <Displayer>().NeedToBeShown)
                {
                    ACardInfoIsShown = true;
                    isACardShow      = true;


                    //
                    menuManager.GoCardsInfo[i].GetComponentInChildren <Displayer>().NeedToBeShown = false;
                }
                else
                {
                    //GlowController.UnregisterObject((menuManager.GoCardsInfo[i].GetComponentInChildren<GlowObjectCmd>()));


                    menuManager.GoCardsInfo[i].GetComponentInChildren <Displayer>().IsShown = false;
                }
            }
            if (!isACardShow)
            {
                for (int i = 0; i < menuManager.GoCardsInfo.Count; i++)
                {
                    GlowController.RegisterObject((menuManager.GoCardsInfo[i].GetComponentInChildren <GlowObjectCmd>()));
                    menuManager.SetActiveChatBoxes(true);
                }

                ACardInfoIsShown = false;
            }

            box.UpdateLockAspect();
        }
    }
Ejemplo n.º 16
0
    void UpdateCardLevelPositions()
    {
        carLevelfLerp += Time.unscaledDeltaTime * 3.5f;

        if (carLevelfLerp > 1)
        {
            carLevelfLerp = 1;
        }

        if (carLevelfLerp > (!menuManager.GoDeck.GetComponent <Deck>().IsOpen ? 0.4 : 0.4f) && !hasReachStepOne)
        {
            whereTheCardiS.Clear();
            whereTheCardiSrotation.Clear();
            for (int i = 0; i < menuManager.GoCardsLevels.Count; i++)
            {
                whereTheCardiS.Add(menuManager.GoCardsLevels[i].transform.position);
                whereTheCardiSrotation.Add(menuManager.GoCardsLevels[i].transform.rotation);
            }
            hasReachStepOne = true;
            carLevelfLerp   = 0;
            index           = 1;
        }

        if (carLevelfLerp > (!menuManager.GoDeck.GetComponent <Deck>().IsOpen? 0.5 : 0.95f) && !hasReachStepTwo && hasReachStepOne)
        {
            whereTheCardiS.Clear();
            whereTheCardiSrotation.Clear();
            for (int i = 0; i < menuManager.GoCardsLevels.Count; i++)
            {
                whereTheCardiS.Add(menuManager.GoCardsLevels[i].transform.localPosition);
                whereTheCardiSrotation.Add(menuManager.GoCardsLevels[i].transform.localRotation);
            }
            carLevelfLerp   = 0;
            hasReachStepTwo = true;
            index           = 2;
            if (menuManager.GoDeck.GetComponent <Deck>().IsOpen)
            {
                for (int i = 0; i < menuManager.GoCardsLevels.Count; i++)
                {
                    GlowController.UnregisterObject(menuManager.GoCardsLevels[i].GetComponent <GlowObjectCmd>());
                }
                menuManager.SetActiveChatBoxes(true);
            }
            else
            {
                for (int i = 0; i < menuManager.GoCardsLevels.Count; i++)
                {
                    GlowController.RegisterObject(menuManager.GoCardsLevels[i].GetComponent <GlowObjectCmd>());
                }
                menuManager.SetActiveChatBoxes(false);
            }
        }


        for (int i = 0; i < menuManager.GoCardsLevels.Count; i++)
        {
            if (!menuManager.GoDeck.GetComponent <Deck>().IsOpen)
            {
                if (menuManager.GoCardsLevels[i] != LevelCardSelected)
                {
                    if (index == 2)
                    {
                        Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().bloomIntensity = 1f - (carLevelfLerp * 0.65f);
                        Camera.main.GetComponent <UnityStandardAssets.ImageEffects.BloomAndFlares>().sepBlurSpread  = 1.5f - (carLevelfLerp * 1.4f);
                    }



                    menuManager.GoCardsLevels[i].transform.position = Vector3.Lerp(whereTheCardiS[i], levelCardKeyPoses[i][index].v3Pos, carLevelfLerp);
                    menuManager.GoCardsLevels[i].transform.rotation = Quaternion.Lerp(whereTheCardiSrotation[i], levelCardKeyPoses[i][index].quatRot, carLevelfLerp);
                }
            }
            else
            {
                if (menuManager.GoCardsLevels[i] != LevelCardSelected && menuManager.GoCardsLevels[i] != previousCardSelected)
                {
                    menuManager.GoCardsLevels[i].transform.position = Vector3.Lerp(whereTheCardiS[i], levelCardKeyPoses[i][levelCardKeyPoses[i].Count - (index) - 1].v3Pos, carLevelfLerp);
                    menuManager.GoCardsLevels[i].transform.rotation = Quaternion.Lerp(whereTheCardiSrotation[i], levelCardKeyPoses[i][levelCardKeyPoses[i].Count - (index) - 1].quatRot, carLevelfLerp);
                }
                else
                {
                    if (previousCardSelected != null && menuManager.GoCardsLevels[i] == previousCardSelected && previousCardSelected.GetComponent <CardLevel>().IsSelected)
                    {
                        if (hasReachStepTwo)
                        {
                            previousCardSelected.transform.position = Vector3.Lerp(levelCardKeyPoses[0][1].v3Pos, levelCardKeyPoses[0][0].v3Pos, carLevelfLerp);
                            previousCardSelected.transform.rotation = Quaternion.Lerp(levelCardKeyPoses[0][1].quatRot, levelCardKeyPoses[0][0].quatRot, carLevelfLerp);
                        }
                        else if (hasReachStepOne)
                        {
                            previousCardSelected.transform.position = Vector3.Lerp(levelCardSelectedPosition2.position, levelCardKeyPoses[0][1].v3Pos, carLevelfLerp);
                            previousCardSelected.transform.rotation = Quaternion.Lerp(levelCardSelectedPosition2.rotation, levelCardKeyPoses[0][1].quatRot, carLevelfLerp);
                        }
                        else
                        {
                            previousCardSelected.transform.position = Vector3.Lerp(levelCardSelectedPosition.position, levelCardSelectedPosition2.position, carLevelfLerp);
                            previousCardSelected.transform.rotation = Quaternion.Lerp(levelCardSelectedPosition.rotation, levelCardSelectedPosition2.rotation, carLevelfLerp);
                        }
                    }
                }
            }
        }


        if (carLevelfLerp == 1)
        {
            menuManager.GoDeck.GetComponent <Deck>().IsOpen = !menuManager.GoDeck.GetComponent <Deck>().IsOpen;
            aCardIsShown = !aCardIsShown;
            box.UpdateLockAspect();

            isACardMoving   = false;
            carLevelfLerp   = 0;
            index           = 1;
            hasReachStepOne = false;
            hasReachStepTwo = false;
        }
    }
Ejemplo n.º 17
0
 public void ActiveGlow()
 {
     GlowController.RegisterObject(this);
     Debug.Log("add glow" + this);
 }