Пример #1
0
    public override void SelfDestroy()
    {
        //EnemyRole.SetAllMonsterUnarm();
        switch (AmmoHitCondition)
        {
        case HitCondition.Hit:
            BattleManager.SetRecord("StrikeTimes", 1, Operator.Plus);
            BattleManager.SetRecord("MaxComboStrikes", 1, Operator.Plus);
            BattleManager.SetRecord("WeaknessStrikeTimes", 1, Operator.Plus);
            if (BattleManager.MaxComboStrikes > 1)
            {
                BattleCanvas.ShowScoreOnEnemy(string.Format("{0}x{1}", GameDictionary.String_UIDic["CriticalCombo"].GetString(Player.UseLanguage), BattleManager.MaxComboStrikes), string.Format("{0}{1}", "+", BattleManager.MySelf.CriticalScore + BattleManager.MaxComboStrikes));
            }
            else
            {
                BattleCanvas.ShowScoreOnEnemy(GameDictionary.String_UIDic["CriticalHit"].GetString(Player.UseLanguage), string.Format("{0}{1}", "+", BattleManager.MySelf.CriticalScore));
            }
            break;

        case HitCondition.HitShell:
            BattleManager.SetRecord("MaxComboStrikes", 0, Operator.Equal);
            BattleCanvas.ShowScoreOnEnemy(GameDictionary.String_UIDic["ShieldHit"].GetString(Player.UseLanguage), string.Format("{0}{1}", "+", BattleManager.MySelf.ShieldStrikeScore));
            break;

        case HitCondition.NoHit:
            BattleManager.SetRecord("MaxComboStrikes", 0, Operator.Equal);
            break;
        }

        base.SelfDestroy();
    }
Пример #2
0
 public void Init(PlayerRole _pr, EnemyRole _er)
 {
     MySelf = transform.GetComponent <BattleCanvas>();
     PlayerRole.SetGraphicRaycaster(GetComponent <GraphicRaycaster>(), GetComponent <EventSystem>());
     RelyPRole = _pr;
     RelyERole = _er;
 }
Пример #3
0
 void SetShield()
 {
     Trans_Shield.gameObject.SetActive(true);
     ShieldAngle           = Random.Range(0, 360);
     Trans_Shield.rotation = Quaternion.Euler(new Vector3(0, 0, ShieldAngle));
     BattleCanvas.EnemyShieldRotate();
 }
Пример #4
0
    void Move()
    {
        Vector2 movePos = new Vector2(Random.Range(-MoveRangeX, MoveRangeX), MovePosY);

        transform.position = movePos;
        BattleCanvas.EnemySetPos();
    }
Пример #5
0
 public static void Lose()
 {
     CanPressSettingBtn = false;
     SetPause(true);
     BattleCanvas.Lose();
     PlayerRole.SetCanShoot(false);
 }
Пример #6
0
 public override void StartConditionRefresh()
 {
     base.StartConditionRefresh();
     SetShield();
     BattleCanvas.UpdatePlayerHealth();
     SetCanShoot(true);
 }
Пример #7
0
 public void Revive()
 {
     IsAlive = true;
     HealHP(MaxHealth);
     BattleCanvas.UpdatePlayerHealth();
     BattleCanvas.ShowRole(MyForce, true);
 }
Пример #8
0
 // Use this for initialization
 public static void StartGame()
 {
     ClearGame();
     MySelf.SpawnRoles();
     MySelf.MyBattleCanvas.Init(MyPlayerRole, MyEnemyRole);
     BattleCanvas.SetStage();
     SetPause(true);
     BattleCanvas.StartGame();
 }
Пример #9
0
 public override void ShieldBeSruck(int _dmg)
 {
     base.ShieldBeSruck(_dmg);
     ShieldLevel -= 1;
     if (ShieldLevel < 1)
     {
         ShieldLevel = 0;
         Trans_Shield.gameObject.SetActive(false);
         BattleCanvas.PlayerDisArm();
     }
 }
Пример #10
0
 public static void ReStartGame()
 {
     ClearGame();
     MySelf.SpawnRoles();
     MySelf.MyBattleCanvas.Init(MyPlayerRole, MyEnemyRole);
     BattleCanvas.ReStartGame();
     MyPlayerRole.StartConditionRefresh();
     MyEnemyRole.StartConditionRefresh();
     SetPause(true);
     BattleCanvas.StartGame();
 }
Пример #11
0
 public void SetShield()
 {
     if (ShieldLevel < 1)
     {
         Trans_Shield.gameObject.SetActive(false);
         BattleCanvas.PlayerDisArm();
         return;
     }
     Trans_Shield.gameObject.SetActive(true);
     Trans_Shield.rotation = Quaternion.Euler(new Vector3(0, 0, ShieldAngle));
     BattleCanvas.PlayerShieldRotate();
 }
Пример #12
0
 public void StartTarget(Skill skill, SkillActionMenu previousMenu)
 {
     gameObject.SetActive(true);
     Skill        = skill;
     PreviousMenu = previousMenu;
     TargetChosen = false;
     BattleCanvas = BattleController.Instance.battleCanvas;
     SetupTargets();
     if (!TargetChosen)
     {
         Targeting = StartCoroutine(TargetingCoroutine());
     }
 }
Пример #13
0
 public static void NextGame()
 {
     MySelf.ClearEnemyRole();
     MySelf.SpanwEnemyRole();
     DestroyAllAmmo();
     MyPlayerRole.SetTarget(MyEnemyRole);
     MySelf.MyBattleCanvas.Init(MyPlayerRole, MyEnemyRole);
     BattleCanvas.ReStartGame();
     MyPlayerRole.StartConditionRefresh();
     MyEnemyRole.StartConditionRefresh();
     SetPause(false);
     CanPressSettingBtn = true;
 }
Пример #14
0
    void Shoot()
    {
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("Damage", Attack);
        data.Add("ShootPos", transform.position);
        data.Add("Force", GetForce());
        data.Add("AmmoBounceTimes", AmmoBounceTimes);
        data.Add("AmmoBounceDamage", AmmoBounceDamage);
        data.Add("DragProportion", GetDragProportion());
        MyAmmoSpawner.Spawn(data);
        Target.LaunchAmmo();
        SetCanShoot(false);
        BattleCanvas.PlayerReleaseBow();
    }
Пример #15
0
 public static void Revive()
 {
     if (!CallingAd)
     {
         return;
     }
     CallingAd          = false;
     IsRevived          = true;
     CanPressSettingBtn = true;
     DestroyAllAmmo();
     BattleCanvas.CallSettle(false);
     MyPlayerRole.Revive();
     PlayerRole.SetCanShoot(true);
     SetPause(false);
 }
Пример #16
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        _battleSystem = FindObjectOfType <BattleSystem>();
        _anim         = GetComponentInChildren <Animator>();

        Utilities._onPhaseChange += PopAnims;
    }
Пример #17
0
 protected virtual bool DeathCheck()
 {
     if (Health <= 0)
     {
         IsAlive = false;
         EffectEmitter.EmitParticle("deathEffect", transform.position, Vector3.zero, null);
         BattleCanvas.ShowRole(MyForce, false);
         MyAudio.PlaySound(DieAduio);
         BattleManager.DestroyAllAmmo();
     }
     else
     {
         IsAlive = true;
     }
     return(!IsAlive);
 }
Пример #18
0
    public static void Settlement()
    {
        //存資料
        Dictionary <string, object> data = new Dictionary <string, object>();

        data.Add("WeaknessStrikeTimes", WeaknessStrikeTimes);
        data.Add("MaxComboStrikes", MaxComboStrikes);
        data.Add("ShootTimes", ShootTimes);
        data.Add("Accuracy", Accuracy);
        data.Add("Kill", Kill);
        data.Add("Score", Score);
        data.Add("HighestScoring", HighestScoring);
        Player.UpdateRecord(data);
        //
        BattleCanvas.Settle(data);
        SetPause(true);
    }
    public void BeginBattle(EncounterSet encounter, Sprite backgroundSprite = null, bool playAnimation = false)
    {
        _encounterSet = encounter;
        PlayerController.Instance.PauseGame();

        if (backgroundSprite == null)
        {
            backgroundSprite = GetPlayerGroundSprite();
        }

        battleCanvas = Instantiate(BattleCanvasPrefab).GetComponent <BattleCanvas>();
        battleCanvas.SetupBattleground(backgroundSprite);

        Party   = battleCanvas.SetupParty(PlayerController.Instance.Party);
        Enemies = battleCanvas.SetupMonsters(encounter);
        Party.ForEach((partyMember) => { partyMember.UpdateAnimator(); });

        var bgm = encounter.bgmOverride != null ? encounter.bgmOverride : MapSettings.Instance.BattleBgm;

        MapSettings.Instance.PauseBgm();
        battleCanvas.StartBattleMusic(bgm);

        Battle = Task.Run(BattleLoop, CancelBattle.Token);
    }
Пример #20
0
 public static void Upgrade()
 {
     BattleCanvas.CallSkillUpgrade();
 }
Пример #21
0
 public static void NextLevel()
 {
     Level++;
     BattleCanvas.UpdateLevel();
     BattleCanvas.NextLevel();
 }
Пример #22
0
 public override void ReceiveDmg(int _dmg)
 {
     base.ReceiveDmg(_dmg);
     BattleCanvas.UpdateEnemyHealth();
 }
Пример #23
0
 public override void StartConditionRefresh()
 {
     base.StartConditionRefresh();
     BattleCanvas.UpdateEnemyHealth();
     BattleCanvas.EnemySetPos();
 }
    void loadBattleCanvas(int level, LevelData levelData)
    {
        BattleCanvas battleCanvas = BattleCanvas.Instance;

        battleCanvas.transform.SetParent(transform, false);
        battleCanvas.SetLevelText(level);

        if (level <= 20)
        {
            battleCanvas.SetBgImage("GameMain_1_bg");
        }
        else if (level <= 40)
        {
            battleCanvas.SetBgImage("GameMain_2_bg");
        }
        else if (level <= 60)
        {
            battleCanvas.SetBgImage("GameMain_3_bg");
        }
        else
        {
            Debug.LogError("invalid level");
        }

        string[] target1datas = levelData.target1.Split(',');
        string[] target2datas = levelData.target2.Split(',');
        if (levelData.isTimeOrStep == "0")
        {
            if (target2datas[0] == "-2")
            {
                battleCanvas.SetScoreTipPanel("ScoreTip1");
            }
            else if (target2datas[0] == "11")
            {
                battleCanvas.SetScoreTipPanel("ScoreTip3");
            }
            else
            {
                Debug.LogError("invalid target2datas[0]");
            }


            battleCanvas.SetProp1Image("propTimeUp");
            battleCanvas.SetProp2Image("propStopBaby");
            battleCanvas.SetProp3Image("propBomb");

            battleCanvas.SetProp1Count(PlayerData.GetGameProps(GameProps.TimeUp));
            battleCanvas.SetProp2Count(PlayerData.GetGameProps(GameProps.StopBaby));
            battleCanvas.SetProp3Count(PlayerData.GetGameProps(GameProps.Bomb));
        }
        else if (levelData.isTimeOrStep == "1")
        {
            if (target2datas[0] == "-2")
            {
                battleCanvas.SetScoreTipPanel("ScoreTip2");
            }
            else if (target2datas[0] == "11")
            {
                battleCanvas.SetScoreTipPanel("ScoreTip4");
            }
            else
            {
                Debug.LogError("invalid target2datas[0]");
            }


            battleCanvas.SetProp1Image("propStepUp");
            battleCanvas.SetProp2Image("propStopBaby");
            battleCanvas.SetProp3Image("propBomb");

            battleCanvas.SetProp1Count(PlayerData.GetGameProps(GameProps.StepUp));
            battleCanvas.SetProp2Count(PlayerData.GetGameProps(GameProps.StopBaby));
            battleCanvas.SetProp3Count(PlayerData.GetGameProps(GameProps.Bomb));
        }
        else
        {
            Debug.LogError("invalid levelData.isTimeOrStep");
        }


        if (target2datas[0] == "11")
        {
            battleCanvas.GetScoreTipPanel().SetTarget2Icon("RescueObject_type11");
            battleCanvas.GetScoreTipPanel().SetTarget2Text(target2datas[1]);
        }

        battleCanvas.GetScoreTipPanel().SetTimeOrStep(Convert.ToInt32(levelData.timeStep));
        battleCanvas.GetScoreTipPanel().SetScoreText("0 / " + target1datas[1]);
    }
Пример #25
0
 void Start()
 {
     S = this;
     gameObject.SetActive (false);
 }
Пример #26
0
    void ClickToSpawn()
    {
        if (BattleManager.IsPause)
        {
            return;
        }
        if (!CanShoot)
        {
            return;
        }
        if (Input.GetMouseButtonDown(0))
        {
            //Set up the new Pointer Event
            m_PointerEventData = new PointerEventData(m_EventSystem);
            //Set the Pointer Event Position to that of the mouse position
            m_PointerEventData.position = Input.mousePosition;
            //Create a list of Raycast Results
            List <RaycastResult> results = new List <RaycastResult>();
            //Raycast using the Graphics Raycaster and mouse click position
            m_Raycaster.Raycast(m_PointerEventData, results);
            //For every result returned, output the name of the GameObject on the Canvas hit by the Ray
            foreach (RaycastResult result in results)
            {
                if (result.gameObject.tag == "UI")
                {
                    return;
                }
            }

            Ray ray = MyCamera.ScreenPointToRay(Input.mousePosition);
            StartPos = ray.origin + (ray.direction * MyCamera.transform.position.z * -1);


            Go_EndPos.transform.position   = StartPos;
            Go_StartPos.transform.position = StartPos;
            IsPress   = true;
            DragTimer = 0;
        }
        if (Input.GetMouseButton(0))
        {
            if (!IsPress)
            {
                return;
            }
            DragTimerFnc();
            if (IsDrag)
            {
                Ray ray = MyCamera.ScreenPointToRay(Input.mousePosition);
                CurPos = ray.origin + (ray.direction * MyCamera.transform.position.z * -1);
                Go_EndPos.transform.position = CurPos;;
                float angle = MyMath.GetAngerFormTowPoint2D(CurPos, StartPos);
                BattleCanvas.PlayerBowDraw(180 - angle, GetDragProportion());
            }
        }
        if (Input.GetMouseButtonUp(0))
        {
            if (IsPress)
            {
                IsPress = false;
            }
            else
            {
                return;
            }

            if (!IsDrag)
            {
                return;
            }
            else
            {
                IsDrag = false;
            }
            Go_StartPos.SetActive(false);
            Go_EndPos.SetActive(false);
            Ray ray = MyCamera.ScreenPointToRay(Input.mousePosition);
            CurPos = ray.origin + (ray.direction * MyCamera.transform.position.z * -1);
            EndPos = CurPos;
            Shoot();
        }
    }
Пример #27
0
 public void Choice()
 {
     BattleManager.MyPlayerRole.GetUpgrade(RelyData);
     BattleCanvas.EndCallSkillBoard();
     BattleManager.NextLevel();
 }