Esempio n. 1
0
    bool OnInput(InputOnce input)
    {
        if (input.type == InputType.Tap)
        {
            //CommonLogger.Log ("Tap");
            foreach (TapTaper t in m_RegTaps)
            {
                t.TapInput(input);
            }
        }

        if (input.type == InputType.Slice)
        {
            if ((input.second_point - input.tap_point).magnitude >= 20)
            {
                CommonLogger.Log("Slice");
                if (input.slice_cb != null)
                {
                    input.slice_cb();
                }
                return(true);
            }
        }
        return(false);
    }
Esempio n. 2
0
    public void UseSkill()
    {
        OnActionStarted();

        CommonLogger.Log("Programmer::UseSkill => 프로그래머의 스킬 사용이 시작됨.");
        StartCoroutine(StartUseSkill());
    }
Esempio n. 3
0
    public void SetUnits(IEnumerable <Programmer> programmers, AbstractProject boss, Field stageField)
    {
        CommonLogger.Log("UnitManager::SetUnits => 초기화 시작.");

        if (programmers == null || boss == null || stageField == null)
        {
            DebugLogger.LogError("UnitManager::SetUnits => 주어진 프로그래머, 보스 또는 필드 중 Null이 존재함.");
            throw new ArgumentNullException();
        }

        CurrentAppliedFormation = null;

        OnTurnChanged += RemoveDeadPlayerIfTurnChangedToPlayer;
        OnTurnChanged += RequestBossActionIfTurnChangedToBoss;
        OnTurnChanged += PermitProgrammersActionIfTurnChangedToPlayer;
        OnTurnChanged += ApplyBurfsIfTurnChangedToPlayer;
        OnTurnChanged += DecreaseActiveSkillCooldownIfTurnChangedToPlayer;
        programmerActingDictionary =
            programmers.ToDictionary(keySelector: programmer => programmer,
                                     elementSelector: programmer => false);

        this.boss       = boss;
        this.stageField = stageField;

        SubscribeToBoss();
        SubscribeToProgrammers();

        Turn = TurnState.Player;
        SetVacationLimitToProgrammers();

        CommonLogger.Log("UnitManager::SetUnits => 초기화 완료.");
    }
Esempio n. 4
0
    private void PermitProgrammersActionIfTurnChangedToPlayer(TurnState turn)
    {
        if (turn == TurnState.Player)
        {
            foreach (var programmer in programmerActingDictionary.Keys.ToArray())
            {
                programmerActingDictionary[programmer] = false;
            }

            //Burf Turn Decrease and Remove expired Burf
            foreach (var iter in Programmers)
            {
                for (int i = 0, delete = 0; i < iter.Status.Deburf.Count; i++)
                {
                    iter.Status.Deburf[i - delete].DecreaseTurn();
                    if (iter.Status.Deburf[i - delete].Turn < 1)
                    {
                        iter.Status.Deburf.RemoveAt(i - delete);
                        delete++;
                    }
                }
            }

            CommonLogger.Log("UnitManager::PermitProgrammersActionIfTurnChangedToPlayer => 모든 프로그래머의 행동 여부가 초기화됨.");
        }
    }
Esempio n. 5
0
 private void DecayProgrammerBurfs()
 {
     CommonLogger.Log("UnitManager::DecayBurfsIfTurnChangedToBoss => 프로그래머의 버프 유지 시간을 감소시킴.");
     foreach (var programmer in Programmers)
     {
         programmer.DecayBurfs();
     }
 }
Esempio n. 6
0
    public void DisposeRegisteredEvents()
    {
        OnStatusChanged         = delegate { };
        OnElapsedDayChanged     = delegate { };
        OnStageDirectionChanged = delegate { };

        CommonLogger.Log("StageStatusManager::DisposeRegisteredEvents => 이벤트 Disposing 완료.");
    }
Esempio n. 7
0
    private void Awake()
    {
        CommonLogger.SetMask(LoggerLevel.Error, LoggerLevel.Warning, LoggerLevel.Debug);
        var path = Application.persistentDataPath + "/ " + System.DateTime.Now.ToShortTimeString();

        CommonLogger.Log(LoggerLevel.Debug, "path is " + path);
        CommonLogger.SetWritePath(path);
        CommonLogger.Log(LoggerLevel.Warning, "Awake", LogColor.blue);
    }
Esempio n. 8
0
    private void Rotate(Vector3 direction)
    {
        CommonLogger.LogFormat("Programmer::Rotate => 프로그래머가 회전 명령을 받음. RotateDirection = {0}", direction);

        var normalizedDirection = direction.normalized;
        var newRotation         = Quaternion.LookRotation(normalizedDirection);

        transform.rotation = newRotation;

        CommonLogger.Log("Programmer::Rotate => 프로그래머가 회전이 완료됨.");
    }
Esempio n. 9
0
    private void ChangeTurnToBossIfAllProgrammersPerformAction()
    {
        if (programmerActingDictionary.Values.All(actingState => actingState) && currentTurn != TurnState.GameEnd)
        {
            CommonLogger.Log("UnitManager::ChangeTurnToBossIfAllProgrammersPerformAction => 모든 프로그래머가 행동을 수행해 턴이 보스로 넘어감.");

            Turn = TurnState.Boss;
        }
        else if (currentTurn == TurnState.GameEnd)
        {
            CommonLogger.Log("UnitManager::ChangeTurnToBossIfAllProgrammersPerformAction => 모든 프로그래머가 행동을 수행했고, 보스가 사망함.");
        }
    }
Esempio n. 10
0
    private IEnumerator StartMove(Vector3 deltaPosition)
    {
        var rotationBeforeMoving = transform.rotation;

        OnMovingStarted(deltaPosition);

        yield return(Translate(deltaPosition));

        transform.rotation = rotationBeforeMoving;

        CommonLogger.Log("Programmer::Move => 프로그래머의 이동이 종료됨.");

        OnMovingEnded(transform.position);
        OnActionFinished();
    }
Esempio n. 11
0
    public void SetStage()
    {
        CommonLogger.Log("StageManager::SetStage => 초기화 시작");
        CurrentStage = LobbyManager.Instance.SelectedStage.Clone();
        StageField   = fieldSpawner.SpawnField();

        Status.InitializeStageStatus(maximumDayLimit: CurrentStage.ElapsedDayLimit, unitManager: Unit);

        InitializeProgrammers();
        InitializeBoss();

        Unit.SetUnits(Programmers, Boss, StageField);
        Status.RegisterEventAfterInit(unitManager: Unit);

        Status.OnStageDirectionChanged += AdjustStageDirectionView;
    }
Esempio n. 12
0
    public void Burf(List <BurfStructure> burf)
    {
        foreach (var iter in burf)
        {
            switch (iter.Type)
            {
            case BurfType.Cure:
                int healedHP = (int)(Status.FullHealth * iter.Factor);
                Status.Health = Mathf.Clamp(Status.Health + healedHP, 0, Status.FullHealth);
                CommonLogger.Log("Boss Cured " + healedHP + "\n");
                break;

            default:
                Status.Burf.Add(iter);
                break;
            }
        }
    }
Esempio n. 13
0
    private IEnumerator StartUseSkill()
    {
        OnSkillStarted();

        yield return(new WaitForSeconds(0.5f));

        var particle = Instantiate(testEffect, skillSpellPositionObject.transform);

        particle.transform.position = skillSpellPositionObject.transform.position;
        particle.gameObject.SetActive(true);

        yield return(new WaitForSeconds(1.5f));

        Destroy(particle.gameObject);

        CommonLogger.Log("Programmer::UseSkill => 프로그래머의 스킬 사용이 끝남.");

        OnSkillEnded();
        OnActionFinished();
    }
Esempio n. 14
0
    private void ChangeTurnToBossIfAllProgrammersPerformAction()
    {
        if (programmerActingDictionary.Values.All(actingState => actingState) && currentTurn != TurnState.GameEnd)
        {
            CommonLogger.Log("UnitManager::ChangeTurnToBossIfAllProgrammersPerformAction => 모든 프로그래머가 행동을 수행해 턴이 보스로 넘어감.");

            StageManager.Instance.StageField.BlockCellClicking();
            StageManager.Instance.StageUi.SetBlockUiState(true);

            foreach (var prog in Programmers)
            {
                prog.gameObject.layer = 2;
            }

            StartCoroutine(Delay(0.25f, () => Turn = TurnState.Boss));
        }
        else if (currentTurn == TurnState.GameEnd)
        {
            CommonLogger.Log("UnitManager::ChangeTurnToBossIfAllProgrammersPerformAction => 모든 프로그래머가 행동을 수행했고, 보스가 사망함.");
        }
    }
Esempio n. 15
0
    public void InitializeStageStatus(int maximumDayLimit, UnitManager unitManager)
    {
        CommonLogger.Log("StageStatusManager::InitializeStageStatus => 초기화 시작");

        OnElapsedDayChanged += SetToGameOverIfDayExceeded;

        unitManager.OnTurnChanged += SetToGameOverIfDayIsEqualToLimitAndTurnChangedToBoss;
        unitManager.OnTurnChanged += IncreaseDayIfTurnChangedToPlayer;
        OnStatusChanged           += SetTurnStageToEnd;
        OnStatusChanged           += ForceReturningFromVacationWhenStageFinished;
        OnStatusChanged           += ForceUnapplyAllBurfsWhenStageFinished;

        this.MaximumDayLimit = maximumDayLimit;
        this.unitManager     = unitManager;

        StageDirection = Direction.Right;
        CurrentStatus  = StageStatus.InProgress;

        ElapsedDays = 0;

        CommonLogger.Log("StageStatusManager::InitializeStageStatus => 초기화 완료");
    }
Esempio n. 16
0
    public void DisposeRegisteredEvents()
    {
        OnTurnChanged = delegate { };

        CommonLogger.Log("UnitManager::DisposeRegisteredEvents => 이벤트 Disposing 완료.");
    }
        public VMDtoJSON_Converter(string[] args)
        {
            VMD_Format_Struct.FORMAT_Expansion.CoordinateSystemList
                                            coordinate_system = VMD_Format_Struct.FORMAT_Expansion.CoordinateSystemList.LeftHand;
            bool   flag_LeftHand_agrs  = false;
            bool   flag_RightHand_agrs = false;
            bool   flag_MMDHand_agrs   = false;
            bool   flag_help           = false;
            bool   flag_version        = false;
            string input_filename      = string.Empty;
            string output_filename     = string.Empty;

            ////////////////////////
            VMDtoJSON vmdtojson = new VMDtoJSON();

            vmdtojson.SetOutputJsonType(false);

            //vmdtojson.Setting(...));  関数は用意してますが、この関数では使わない

            ////////////////////////
            /// 設定
            ////////////////////////

            for (int i = 0; i < args.Length; i++)
            {
                if ("-F".Equals(args[i]))
                {
                    // 変換対象のVMDファイル
                    if (i + 1 < args.Length)
                    {
                        input_filename = args[i + 1];

                        i = i + 1;
                    }
                }
                else if ("-O".Equals(args[i]))
                {
                    // 出力ファイルパス
                    if (i + 1 < args.Length)
                    {
                        output_filename = args[i + 1];

                        i = i + 1;
                    }
                }
                else if ("-S".Equals(args[i]))
                {
                    // スタートフレーム番号
                    if (i + 1 < args.Length)
                    {
                        int startFrameNo = 0;
                        int.TryParse(args[i + 1], out startFrameNo);
                        vmdtojson.SetStartFrame(startFrameNo);

                        i = i + 1;
                    }
                }
                else if ("-T".Equals(args[i]))
                {
                    // ターゲットID
                    if (i + 1 < args.Length)
                    {
                        int startFrameNo = 0;
                        int.TryParse(args[i + 1], out startFrameNo);
                        vmdtojson.SetTargetID(startFrameNo);

                        i = i + 1;
                    }
                }
                else if ("-M".Equals(args[i]))
                {
                    // minimum json
                    vmdtojson.SetOutputJsonType(true);
                }
                else if ("--lefthand".Equals(args[i].ToLower()))
                {
                    // 座標を左手系に変更する。(デフォルト)
                    flag_LeftHand_agrs = true;
                }
                else if ("--righthand".Equals(args[i].ToLower()))
                {
                    //  座標を右手系に変更する。 [--LeftHand] が指定されていると無効になります。
                    flag_RightHand_agrs = true;
                }
                else if ("--mmdhand".Equals(args[i].ToLower()))
                {
                    //  座標を右手系に変更する。 [--LeftHand] が指定されていると無効になります。
                    flag_MMDHand_agrs = true;
                }
                else if (("-v".Equals(args[i].ToLower()) || ("--version".Equals(args[i].ToLower()))))
                {
                    // バージョン
                    flag_version = true;
                }
                else if (("-q".Equals(args[i])))
                {
                    // ログを出力させない
                    CommonLogger.OutputBorderLevel = CommonLogger.LEVEL.REPORT;
                }
                else if (("-h".Equals(args[i].ToLower()) || ("--help".Equals(args[i].ToLower()))))
                {
                    // ヘルプ
                    flag_version = true;
                    flag_help    = true;
                    break;
                }
            }
            ////////////////////////
            /// 入力設定の変更
            ////////////////////////
            if (true == flag_LeftHand_agrs)
            {
                coordinate_system = VMD_Format_Struct.FORMAT_Expansion.CoordinateSystemList.LeftHand;
            }
            else if (true == flag_RightHand_agrs)
            {
                coordinate_system = VMD_Format_Struct.FORMAT_Expansion.CoordinateSystemList.RightHand;
            }
            else if (true == flag_MMDHand_agrs)
            {
                coordinate_system = VMD_Format_Struct.FORMAT_Expansion.CoordinateSystemList.MMDHand;
            }
            else
            {
                coordinate_system = VMD_Format_Struct.FORMAT_Expansion.CoordinateSystemList.LeftHand;
            }
            vmdtojson.SetCoordinateSystem(coordinate_system);

            ////////////////////////
            /// 変換
            ////////////////////////
            if (false == flag_help)
            {
                if (true == flag_version)
                {
                    CommonLogger.Log(CommonLogger.LEVEL.INFO, "==================");
                    CommonLogger.Log(CommonLogger.LEVEL.INFO, CommonFunction.ProductName() + " Ver." + CommonFunction.ProductVersion());
                }
                if (0 != input_filename.Length)
                {
                    vmdtojson.Convert(input_filename);
                    if (0 != output_filename.Length)
                    {
                        vmdtojson.OutputFile(output_filename);
                    }
                    else
                    {
                        CommonLogger.Log(CommonLogger.LEVEL.INFO, "==================");
                        CommonLogger.Log(Common.CommonLogger.LEVEL.REPORT, vmdtojson.GetJsonTest());
                    }
                }
                else
                {
                    if (true != flag_version)
                    {
                        CommonLogger.Log(CommonLogger.LEVEL.ERROR, "NOT found VMD FILE.");
                    }
                }
            }
            else
            {
                CommonLogger.Log(CommonLogger.LEVEL.REPORT,
                                 "==================" + System.Environment.NewLine
                                 + CommonFunction.ProductName()
                                 + " Ver." + CommonFunction.ProductVersion() + System.Environment.NewLine
                                 + "==================");

                // usage
                CommonLogger.Log(Common.CommonLogger.LEVEL.REPORT,
                                 " usage: VMDtoJSON"
                                 + " [-v | --version] [-h | --help]"
                                 + " [-F <Input VMD file path>]"
                                 + " [-O <Output JSON file path>]"
                                 + " [-S <FrameNo>]"
                                 + " [-T <TargetID>]"
                                 + " [-M]"
                                 + " [-q]" + System.Environment.NewLine
                                 );

                // Get application information
                CommonLogger.Log(Common.CommonLogger.LEVEL.REPORT,
                                 " Options and arguments" + System.Environment.NewLine
                                 + "   Get application information" + System.Environment.NewLine
                                 + "     -v             : " + "print this software version number (also --version)" + System.Environment.NewLine
                                 + "     -h             : " + "print this help message and exit (also --help)" + System.Environment.NewLine
                                 );

                // Manipulating output data
                CommonLogger.Log(Common.CommonLogger.LEVEL.REPORT,
                                 "   Manipulating output data" + System.Environment.NewLine
                                 + "     -F input_file  : " + "convert this file. <input_file>" + System.Environment.NewLine
                                 + "     -O output_file : " + "output JSON file to this path. <output_file>" + System.Environment.NewLine
                                 + "     -S frame_no    : " + "start the frame number<frame_no> from the specified number." + System.Environment.NewLine
                                 + "     -T targetID    : " + "set the <targetID> in the extension header." + System.Environment.NewLine
                                 + "     -M             : " + "make a JSON file with no line breaks or spaces." + System.Environment.NewLine
                                 + "     -q             : " + "don't print version and copyright messages on interactive startup." + System.Environment.NewLine
                                 );

                // Manipulating output data
                CommonLogger.Log(Common.CommonLogger.LEVEL.REPORT,
                                 "   CoordinateSystem(" + System.Environment.NewLine
                                 + "     --LeftHand     : " + "Output Left hand Coordinate System. Priorty Hight (defalut) " + System.Environment.NewLine
                                 + "     --RightHand    : " + "Output Left hand Coordinate System. Priorty Middle" + System.Environment.NewLine
                                 + "     --MMDtHand     : " + "Output Left hand Coordinate System. Priorty Low" + System.Environment.NewLine
                                 );
            }
        }
Esempio n. 18
0
 public void OnStartButtonClicked()
 {
     CommonLogger.Log("Goes To Game");
     UnityEngine.SceneManagement.SceneManager.LoadScene("InGame");
 }
Esempio n. 19
0
    public static void Log(object message)
    {
#if UNITY_EDITOR
        CommonLogger.Log(message);
#endif
    }
Esempio n. 20
0
 // Use this for initialization
 void Start()
 {
     CommonLogger.Log("StartMain");
     ConfigMng.Instance.Init();
 }
Esempio n. 21
0
    private void RequestBossActionIfTurnChangedToBoss(TurnState turn)
    {
        if (Turn == TurnState.Boss)
        {
            if (Programmers.Where(programmer => programmer.Status.IsOnVacation).Count() ==
                Programmers.Count())
            {
                CommonLogger.Log("UnitManager::RequestBossActionIfTurnChangedToBoss => 보스에게 행동을 요청하려 했으나, 모든 프로그래머가 휴가 중이므로 취소됨.");

                StageManager.Instance.StageUi.RenderPlayerText("프로젝트가 아무런 행동도 수행하지 않았습니다.");
                boss.InvokeFinished();
                return;
            }

            CommonLogger.Log("UnitManager::RequestBossActionIfTurnChangedToBoss => 보스에게 행동을 요청함.");

            //Decrease Boss Skill Cool
            foreach (ProjectSkill iter in Boss.Ability.ProjectSkills)
            {
                iter.DecreaseCooldown();
            }
            //Decrease Boss Burf Cool and Remove if it's Cool down
            for (int i = 0, delete = 0; i < Boss.Status.Burf.Count; i++)
            {
                Boss.Status.Burf[i - delete].DecreaseTurn();
                if (Boss.Status.Burf[i - delete].Turn < 1)
                {
                    Boss.Status.Burf.RemoveAt(i - delete);
                    delete++;
                }
            }

            if (UnityEngine.Random.Range(0, 12) > 9)
            {
                //MOVE
                StageManager.Instance.MoveBoss();
                StageManager.Instance.StageUi.RenderPlayerText("프로젝트의 방향이 전환되었습니다!");
            }
            else
            {
                //DO Attack or Skill
                var usedSkill = boss.Invoke();
                if (usedSkill is ISoundProducible)
                {
                    var clip = (usedSkill as ISoundProducible).EffectSound;
                    SoundManager.Instance.FetchAvailableSource().PlayOneShot(clip);
                }

                StageManager.Instance.StageUi.RenderBossSkillNotice(usedSkill);

                CommonLogger.LogFormat("UnitManager::RequestBossActionIfTurnChangedToBoss => 보스가 {0} 스킬을 사용함.", usedSkill.Information.Name);

                switch (usedSkill.Information.Type)
                {
                case ProjectSkillType.SingleAttack:
                    InvokeSkill((ProjectSingleAttackSkill)usedSkill);
                    break;

                case ProjectSkillType.MultiAttack:
                    InvokeSkill((ProjectMultiAttackSkill)usedSkill);
                    break;

                case ProjectSkillType.SingleDeburf:
                    InvokeSkill((ProjectSingleDeburfSkill)usedSkill);
                    break;

                case ProjectSkillType.MultiDeburf:
                    InvokeSkill((ProjectMultiDeburfSkill)usedSkill);
                    break;

                case ProjectSkillType.Burf:
                    InvokeSkill((ProjectBurfSkill)usedSkill);
                    break;
                }
            }

            if (Turn != TurnState.GameEnd)
            {
                boss.InvokeFinished();
            }
        }
    }
Esempio n. 22
0
 // Use this for initialization
 void Start()
 {
     DoTest();
     CommonLogger.Log(LoggerLevel.Warning, "ab", LogColor.red);
     CommonLogger.Log(LoggerLevel.Debug, "abc", new LogColor(1, 1f, 0.0f));
 }
Esempio n. 23
0
 void OnUnitDead()
 {
     CommonLogger.Log(m_ModelObj.name + " Dead");
     m_AniCtrl.SetTrigger("Dead");
     GameHelper.Game.ReleaseStandPos(this.m_StandPos);
 }