Example #1
0
    /// <summary>
    /// A function to call when a player gets killed. Receives the player killed.
    /// </summary>
    /// <param name="playerKilled"></param>
    public void PlayerKilled(PLAYER playerKilled)
    {
        Vector3 pos = PlayerPool[(int)playerKilled].transform.GetChild(0).position;

        Instantiate(PlayerArtExplosion[(int)playerKilled], pos, Quaternion.Euler(-90, 0, 0));

        PlayerPool[(int)playerKilled].SetActive(false);

        //Set the playerIsAlive bool to false
        PlayerIsAlive[(int)playerKilled] = false;

        //Decrease the number of players alive.
        --m_NumberOfPlayersAlive;

        AudioManager.GlobalAudioManager.PlaySoundEffect(AudioManager.SOUND_EFFECT.DEATH, 0.5f);


        UIManager.GlobalUIManager.PlayerDead((int)playerKilled);

        //Check to see if there is just one player left and the round should end.
        bool RoundEnd = CheckForRoundEnd();

        Time.timeScale = 0.25f;

        if (!RoundEnd)
        {
            StartCoroutine(ResumeNormalTime());
        }
    }
    public void playerSight(PLAYER player)
    {
        switch (player)
        {
        case PLAYER.PLAYER1:
            playerList      = player1.unitList;
            enemyPlayerList = player2.unitList;
            break;

        case PLAYER.PLAYER2:
            playerList      = player2.unitList;
            enemyPlayerList = player1.unitList;
            break;

        case PLAYER.NONE:
            break;

        default:
            break;
        }
        for (int i = 0; i < playerList.Count; ++i)
        {
            enemyPlayerList[i].Show();
        }
        for (int i = 0; i < enemyPlayerList.Count; ++i)
        {
            enemyPlayerList[i].Hide();
        }
    }
Example #3
0
        public async Task <IHttpActionResult> PutPLAYER(int id, PLAYER pLAYER)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != pLAYER.ID)
            {
                return(BadRequest());
            }

            db.Entry(pLAYER).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PLAYERExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #4
0
    private IEnumerator ApDraw(Int32 id)
    {
        Int32 abilId = this.abilityLearned[id][0];

        this.abilityLearned[id].RemoveAt(0);
        String abilName;
        String spriteName;

        if (abilId < 192)
        {
            abilName   = FF9TextTool.ActionAbilityName(abilId);
            spriteName = "ability_stone";
        }
        else
        {
            abilName = FF9TextTool.SupportAbilityName(abilId - 192);
            PLAYER player = FF9StateSystem.Common.FF9.party.member[id];
            spriteName = ((!ff9abil.FF9Abil_IsEnableSA(player.sa, abilId)) ? "skill_stone_off" : "skill_stone_on");
        }
        this.characterBRInfoHudList[id].AbiltySprite.spriteName = spriteName;
        this.characterBRInfoHudList[id].AbilityLabel.text       = abilName;
        this.abilityLearnedPanelTween[id].TweenIn((Action)null);
        yield return(new WaitForSeconds(1f));

        this.abilityLearnedPanelTween[id].TweenOut(delegate
        {
            this.isReadyToShowNextAbil[id] = true;
        });
        yield break;
    }
Example #5
0
    public static void FF9Play_Update(PLAYER play)
    {
        FF9PLAY_INFO  info  = new FF9PLAY_INFO();
        FF9PLAY_SKILL skill = new FF9PLAY_SKILL();

        info.Base   = play.basis;
        info.cur_hp = play.cur.hp;
        info.cur_mp = (UInt16)play.cur.mp;
        for (Int32 index = 0; index < 1; ++index)
        {
            info.sa[index] = play.sa[index];
        }
        info.equip.Absorb(play.equip);
        FF9Play_GetSkill(ref info, ref skill);
        play.elem.dex = skill.Base[0];
        play.elem.str = skill.Base[1];
        play.elem.mgc = skill.Base[2];
        play.elem.wpr = skill.Base[3];
        play.defence.PhisicalDefence = (Byte)skill.weapon[1];
        play.defence.PhisicalEvade   = (Byte)skill.weapon[2];
        play.defence.MagicalDefence  = (Byte)skill.weapon[3];
        play.defence.MagicalEvade    = (Byte)skill.weapon[4];
        play.cur.hp = skill.cur_hp;
        play.cur.mp = (Int16)skill.cur_mp;
        play.max.hp = skill.max_hp;
        play.max.mp = (Int16)skill.max_mp;
    }
    public virtual void Initialation()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <PLAYER>();
        player.Init();

        isFacingRight = true;
    }
Example #7
0
        public void startGame(PLAYER argDwarves, PLAYER argTrolls)
        {
            board = new ThudBoard("thud", this);

            if (argDwarves == PLAYER.HUMAN)
            {
                dwarves = new HumanController();
            }
            else
            {
                dwarves = new AIController();
            }

            if (argTrolls == PLAYER.HUMAN)
            {
                trolls = new HumanController();
            }
            else
            {
                trolls = new AIController();
            }

            dwarves.setSide(SIDE.DWARF);
            trolls.setSide(SIDE.TROLL);

            startRound();
        }
        private void PopulatePlayerInfo()
        {
            CurrentPlayerID = Global.Instance.SelectedPlayerID;

            try
            {
                var forgeDatabase = Global.Instance.ForgeDatabase();

                PLAYER player = forgeDatabase.Players.Single(p => p.ID == CurrentPlayerID);

                StoryID            = player.StoryID;
                PlayerName.Text    = player.PlayerName;
                CharacterName.Text = player.CharacterName;
                HitPoints.Text     = player.HitPoints.ToString();
                Alignment.Text     = player.Alignment;
                ArmorClass.Text    = player.ArmorClass.ToString();
                TouchAC.Text       = player.TouchAC.ToString();
                FlatFootedAC.Text  = player.TouchAC.ToString();
                CMD.Text           = player.CMD.ToString();
                Fort.Text          = player.Fort.ToString();
                Ref.Text           = player.Ref.ToString();
                Will.Text          = player.Will.ToString();
                Str.Text           = player.Str.ToString();
                Dex.Text           = player.Dex.ToString();
                Con.Text           = player.Con.ToString();
                Int.Text           = player.Int.ToString();
                Wis.Text           = player.Wis.ToString();
                Cha.Text           = player.Cha.ToString();
            }
            catch
            { }
        }
        private void AcceptDialog(object sender, RoutedEventArgs e)
        {
            var forgeDatabase = Global.Instance.ForgeDatabase();

            PLAYER player = forgeDatabase.Players.Single(p => p.ID == CurrentPlayerID);

            player.PlayerName    = PlayerName.Text;
            player.CharacterName = CharacterName.Text;
            player.HitPoints     = ParseString(HitPoints.Text);
            player.Alignment     = Alignment.Text;
            player.ArmorClass    = ParseString(ArmorClass.Text);
            player.TouchAC       = ParseString(ArmorClass.Text);
            player.FlatFootedAC  = ParseString(FlatFootedAC.Text);
            player.CMD           = ParseString(CMD.Text);
            player.Fort          = ParseString(Fort.Text);
            player.Ref           = ParseString(Ref.Text);
            player.Will          = ParseString(Will.Text);
            player.Str           = ParseString(Str.Text);
            player.Dex           = ParseString(Dex.Text);
            player.Con           = ParseString(Con.Text);
            player.Int           = ParseString(Int.Text);
            player.Wis           = ParseString(Wis.Text);
            player.Cha           = ParseString(Cha.Text);

            forgeDatabase.SubmitChanges();

            IoC.Get <IEventAggregator>().PublishOnUIThread("AcceptAddPlayerDialog");
            IoC.Get <IEventAggregator>().PublishOnUIThread("AcceptRootDialog");
        }
Example #10
0
    private void DisplayCharacterPartyAvatar(Byte id, PLAYER player, UISprite avatarSprite, UISprite[] avatarStatusAlignment)
    {
        FF9UIDataTool.DisplayCharacterAvatar(player, default(Vector3), default(Vector3), avatarSprite, false);
        avatarSprite.alpha = ((!this.info.fix[id]) ? 1f : 0.5f);
        for (Int32 i = 0; i < avatarStatusAlignment.Length; i++)
        {
            UISprite uISprite = avatarStatusAlignment[i];
            uISprite.alpha = 0f;
        }
        Int32 num = 0;

        if ((player.status & 2) != 0)
        {
            avatarStatusAlignment[num].spriteName = Localization.Get("PartyStatusTextPoison");
            avatarStatusAlignment[num].alpha      = 1f;
            num++;
        }
        if ((player.status & 1) != 0)
        {
            avatarStatusAlignment[num].spriteName = Localization.Get("PartyStatusTextStone");
            avatarStatusAlignment[num].alpha      = 1f;
            num++;
        }
        if (player.cur.hp == 0)
        {
            avatarStatusAlignment[num].spriteName = "text_ko";
            avatarStatusAlignment[num].alpha      = 1f;
            num++;
        }
    }
Example #11
0
    public static void FF9Play_SetParty(int party_id, int slot_id)
    {
        FF9StateGlobal ff9StateGlobal = FF9StateSystem.Common.FF9;
        PLAYER         player         = ff9StateGlobal.party.member[party_id];

        if (slot_id >= 9)
        {
            slot_id = -1;
        }

        if (0 > slot_id)
        {
            ff9StateGlobal.party.member[party_id] = null;
        }
        else
        {
            FF9Play_Add(slot_id);
            ff9StateGlobal.party.member[party_id] = ff9StateGlobal.player[slot_id];
        }

        if (player == ff9StateGlobal.party.member[party_id])
        {
            return;
        }

        FF9Play_SetFaceDirty(true);
    }
Example #12
0
        public static Int32 FF9Abil_GetIndex(Int32 slot_id, Int32 abil_id)
        {
            if (slot_id >= 9)
            {
                return(-1);
            }

            PLAYER player = FF9StateSystem.Common.FF9.player[slot_id];

            if (player.info.menu_type >= 16)
            {
                return(-1);
            }

            PA_DATA[] array = _FF9Abil_PaData[player.info.menu_type];
            for (Int32 index = 0; index < array.Length; ++index)
            {
                if (_FF9Abil_PaData[player.info.menu_type][index].id == abil_id)
                {
                    return(index);
                }
            }

            return(-1);
        }
    public void GenerateUnit(int building_id, UnitType unitType, float x, float y)
    {
        if (unitType == UnitType.Mafiaunit)
        {
            newUnit = Instantiate(Resources.Load("Prefabs/Unit")) as GameObject;
        }


        if (newUnit != null)
        {
            PLAYER request_player = GameManager.GetInstance.getBuilding(building_id).player_occupy;
            newUnit.GetComponent <Unit>().initiateUnit(unitType, x, y, request_player);
            GameManager.GetInstance.subtractGold(request_player, GameData.getUnitData(unitType).cost);
        }
        else
        {
            Debug.Log("unit is not instantiated");
            return;
        }

        if (GameManager.GetInstance.myTurn)
        {
            var             m_network = GameObject.FindWithTag("Network").GetComponent <Network>();
            UnitProduceData data      = new UnitProduceData();
            data.buildingId   = building_id;
            data.producedUnit = (int)unitType;
            //data.x = x;
            //data.y = y;
            UnitProducePacket producePacket = new UnitProducePacket(data);
            m_network.SendReliable(producePacket);
        }
    }
Example #14
0
 // Update is called once per frame
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!collision.gameObject.GetComponentInParent <PlayerController>())
     {
         stop = true;
         GetComponent <FixedJoint2D>().enabled = true;
         if (collision.gameObject.GetComponent <Rigidbody2D>())
         {
             GetComponent <FixedJoint2D>().connectedBody = collision.gameObject.GetComponent <Rigidbody2D>();
             photonView.RPC("connectRigidbody", PhotonTargets.Others, collision.gameObject.GetComponent <Rigidbody2D>());
         }
         GameObject[] player = GameObject.FindGameObjectsWithTag("Player");
         foreach (GameObject PLAYER in player)
         {
             if (PLAYER.GetComponent <PlayerController>().photonView.isMine)
             {
                 PLAYER.GetComponent <PlayerController>().Grapple(transform.position, GetComponent <Rigidbody2D>());
             }
         }
     }
     if (collision.gameObject.GetComponentInParent <PlayerController>() != null)
     {
         PhotonNetwork.Destroy(gameObject);
         GameObject[] player = GameObject.FindGameObjectsWithTag("Player");
         foreach (GameObject PLAYER in player)
         {
             if (PLAYER.GetComponent <PlayerController>().photonView.isMine)
             {
                 PLAYER.GetComponent <PlayerController>().photonView.RPC("stopGrapling", PhotonTargets.All);
             }
         }
     }
 }
Example #15
0
    /// <summary>
    /// The method we will continuously call to move the player around
    /// </summary>
    void SequenceDOTLogic()
    {
        PLAYER.localRotation = Quaternion.identity;

        if (sequenceDOT != null)
        {
            sequenceDOT.Kill(false);
        }

        if (firstStart)
        {
            ResetPosition();
        }

        firstStart = false;

        sequenceDOT = DOTween.Sequence();

        rotateDOTVector *= -1f;

        PLAYER.DOScaleX(-rotateDOTVector.z, 0.2f);

        LoopType loopDot = LoopType.Incremental;

        sequenceDOT.Append(rotatePlayer.DOLocalRotate(rotateDOTVector * 360, 5, RotateMode.FastBeyond360).SetEase(Ease.Linear).SetRelative(true));
        sequenceDOT.SetLoops(1, loopDot);

        sequenceDOT.OnStepComplete(() => {
            SequenceDOTLogic();
        });
    }
Example #16
0
    private float _visibleDistance;             //Нужна для исправления бага.

    void Start()
    {
        PLAYER_SCRIPT = GameObject.FindGameObjectWithTag("Player").GetComponent <PLAYER>();
        NPC           = this.GetComponent <NPC>(); //Добавляем скрипт с этого же объекта

        //Если на объекте нет Агента 007 -> Добавляем его и сразу забиваем на него ссылку
        if (gameObject.GetComponent <NavMeshAgent>() == null)
        {
            NAV_MESH_AGENT = gameObject.AddComponent <NavMeshAgent>();
        }
        //Или же просто забиваем его в ссылку
        else
        {
            NAV_MESH_AGENT = gameObject.GetComponent <NavMeshAgent>();
        }

        //Указываем что останавливатся нужно на дистанции атаки, а не нюхать модельку игрока
        NAV_MESH_AGENT.stoppingDistance = NPC.Stats.AttackDistance;

        //Забиваем число его фракции. (Нужен для того чтобы вернуть его из агрессивного в нейтральный)
        _frictionNumber = (int)NPC.Stats.Friction;         //0-neutral, 1-agressive, 2-friend : friction enum

        //Ну и стартовая позиция записывается при спавне
        START_POSITION = this.transform.position;

        //Сохранение начального значение переменной
        _visibleDistance = NPC.Stats.VisibleDistance;
    }
Example #17
0
    public override Boolean OnKeyRightBumper(GameObject go)
    {
        if (!base.OnKeyRightBumper(go) || !CharacterArrowPanel.activeSelf)
        {
            return(true);
        }

        FF9Sfx.FF9SFX_Play(1047);
        Int32 next = ff9play.FF9Play_GetNext(_currentPartyIndex);

        if (next == _currentPartyIndex)
        {
            return(true);
        }

        _currentPartyIndex = next;
        PLAYER player    = FF9StateSystem.Common.FF9.party.member[this._currentPartyIndex];
        String spritName = FF9UIDataTool.AvatarSpriteName(player.info.serial_no);

        Loading = true;
        Boolean isKnockOut = player.cur.hp == 0;

        _avatarTransition.Change(spritName, HonoAvatarTweenPosition.Direction.RightToLeft, isKnockOut, () =>
        {
            DisplayPlayer(true);
            Loading = false;
        });

        DisplayAllCharacterInfo(false);
        return(true);
    }
Example #18
0
    public Int32 GetPartyMember(Int32 index)
    {
        FF9StateGlobal ff     = FF9StateSystem.Common.FF9;
        PLAYER         player = ff.party.member[index];

        return((Int32)((player == null) ? -1 : ((Int32)player.info.slot_no)));
    }
Example #19
0
    public static void FF9Play_New(int slot_id)
    {
        PLAYER play = FF9StateSystem.Common.FF9.player[slot_id];

        PLAYER_INFO[] playerInfoArray =
        {
            new PLAYER_INFO(0,  1, 1, 1, 0,  0),
            new PLAYER_INFO(1,  2, 0, 1, 0,  1),
            new PLAYER_INFO(2,  3, 0, 1, 0,  2),
            new PLAYER_INFO(3,  7, 1, 1, 0,  3),
            new PLAYER_INFO(4, 12, 0, 1, 0,  4),
            new PLAYER_INFO(5, 14, 1, 1, 0,  8),
            new PLAYER_INFO(6, 15, 1, 1, 0, 10),
            new PLAYER_INFO(7, 16, 1, 1, 0, 12),
            new PLAYER_INFO(8, 18, 1, 1, 0, 14)
        };
        play.info     = playerInfoArray[slot_id];
        play.status   = 0;
        play.category = (byte)FF9Play_GetCategory(play.info.menu_type);
        play.bonus    = new FF9LEVEL_BONUS();
        int charId3 = FF9Play_GetCharID3(play);

        play.name = FF9TextTool.CharacterDefaultName(play.info.menu_type);
        FF9Play_SetDefEquips(play.equip, charId3);
        play.info.serial_no = (byte)FF9Play_GetSerialID(play.info.slot_no, (play.category & 16) != 0, play.equip);
        FF9Play_Build(slot_id, 1, playerInfoArray[slot_id], false);
        play.cur.hp   = play.max.hp;
        play.cur.mp   = play.max.mp;
        play.cur.capa = play.max.capa;
    }
Example #20
0
    void Start()
    {
        playerType = (PLAYER)GetComponent <PlayerManager>().playerNo + 1;

        //assign to correct player here

        //sanity checks here
        if (playerType == PLAYER.UNASSIGNED)
        {
            Debug.LogWarning("playerType of " + name + " is unassigned!");
        }
        else if (playerType == PLAYER.PLAYER1)
        {
            tag = "P1";
        }
        else if (playerType == PLAYER.PLAYER2)
        {
            tag = "P2";
        }
        else if (playerType == PLAYER.PLAYER3)
        {
            tag = "P3";
        }
        else if (playerType == PLAYER.PLAYER4)
        {
            tag = "P4";
        }
        //Reset vars
        facingRight = true;
        canFire     = true;
    }
Example #21
0
    private static void FF9Play_DebugEquip(int slot_no)
    {
        PLAYER play = FF9StateSystem.Common.FF9.player[slot_no];

        byte[][] numArray =
        {
            new byte[] { 15, 135, 101, 167, 192 },
            new byte[] { 78, 135, 101, 175, 192 },
            new byte[] { 63, 135, 101, 175, 192 },
            new byte[] { 30, 147, 111, 191, 192 },
            new byte[] { 40, 147, 111, 191, 192 },
            new byte[] { 84, 135, 101, 175, 192 },
            new byte[] { 69, 135, 101, 175, 232 },
            new byte[] { 50, 135, 101, 167, 194 },
            new byte[] {  0, 135, 101, 167, 192 },
            new byte[] { 25, 135, 101, 167, 192 },
            new byte[] { 25, 135, 101, 167, 192 },
            new byte[] { 26, 147, 111, 191, 192 }
        };
        int charId3 = FF9Play_GetCharID3(play);

        for (int index = 0; index < 5; ++index)
        {
            play.equip[index] = numArray[charId3][index];
        }
        play.info.serial_no = (byte)FF9Play_GetSerialID(play.info.slot_no, (play.category & 16) != 0, play.equip);
        FF9Play_Update(play);
        FF9Play_UpdateSA(play);
    }
Example #22
0
    public static void FF9Play_Update(PLAYER play)
    {
        FF9PLAY_INFO  info  = new FF9PLAY_INFO();
        FF9PLAY_SKILL skill = new FF9PLAY_SKILL();

        info.Base   = play.basis;
        info.cur_hp = play.cur.hp;
        info.cur_mp = (ushort)play.cur.mp;
        for (int index = 0; index < 1; ++index)
        {
            info.sa[index] = play.sa[index];
        }
        for (int index = 0; index < 5; ++index)
        {
            info.equip[index] = play.equip[index];
        }
        FF9Play_GetSkill(ref info, ref skill);
        play.elem.dex      = skill.Base[0];
        play.elem.str      = skill.Base[1];
        play.elem.mgc      = skill.Base[2];
        play.elem.wpr      = skill.Base[3];
        play.defence.p_def = (byte)skill.weapon[1];
        play.defence.p_ev  = (byte)skill.weapon[2];
        play.defence.m_def = (byte)skill.weapon[3];
        play.defence.m_ev  = (byte)skill.weapon[4];
        play.cur.hp        = skill.cur_hp;
        play.cur.mp        = (short)skill.cur_mp;
        play.max.hp        = skill.max_hp;
        play.max.mp        = (short)skill.max_mp;
    }
        private void AcceptDialog(object sender, RoutedEventArgs e)
        {
            PLAYER player = new PLAYER()
            {
                StoryID       = Global.Instance.StoryID,
                PlayerName    = PlayerName.Text,
                CharacterName = CharacterName.Text,
                HitPoints     = ParseString(HitPoints.Text),
                Alignment     = Alignment.Text,
                ArmorClass    = ParseString(ArmorClass.Text),
                TouchAC       = ParseString(TouchAC.Text),
                FlatFootedAC  = ParseString(FlatFootedAC.Text),
                CMD           = ParseString(CMD.Text),
                Fort          = ParseString(Fort.Text),
                Ref           = ParseString(Ref.Text),
                Will          = ParseString(Will.Text),
                Str           = ParseString(Str.Text),
                Dex           = ParseString(Dex.Text),
                Con           = ParseString(Con.Text),
                Int           = ParseString(Int.Text),
                Wis           = ParseString(Wis.Text),
                Cha           = ParseString(Cha.Text)
            };

            var forgeDatabase = Global.Instance.ForgeDatabase();

            forgeDatabase.Players.InsertOnSubmit(player);
            forgeDatabase.SubmitChanges();

            IoC.Get <IEventAggregator>().PublishOnUIThread("AcceptAddPlayerDialog");
            IoC.Get <IEventAggregator>().PublishOnUIThread("AcceptRootDialog");
        }
Example #24
0
 public CInfoPlayerTank(PLAYER _player, PLAYERGUIDE _guide, Vector2 _posStart)
     : base()
 {
     this._player = _player;
     this._guide = _guide;
     this._posStart = _posStart;
 }
    private void PlayGameOverAnimation(Transform d)
    {
        StopAllCoroutines();

        soundManager.PlaySoundFail();
        isGameOver = true;

        //canvasManager.ButtonLogic ();

        jumpTweener.Kill();

        sequence.Kill();

        sequenceDOT.Kill();

        sequenceDOT = null;

        guyAnim.StopAll();

        Vector3 targetPosition = new Vector3(PLAYER.position.x, PLAYER.position.y, Camera.main.transform.position.z);

        canvasManager.music.DOPitch(-1, 1f)
        .OnComplete(() => {
            canvasManager.music.DOPitch(1, 1f);
        });

        Camera.main.transform.DOShakePosition(0.3f, new Vector3(1, 1, 0), 10, 90, false)
        .OnComplete(() => {
            DOVirtual.Float(cameraSize, 5f, 0.3f, (float size) => {
                Camera.main.orthographicSize = size;
            });

            Camera.main.transform.DOMove(targetPosition, 0.3f)
            .OnComplete(() => {
                PLAYER.DOLocalMoveY(floorPosition, 0.3f, false)
                .OnUpdate(() => {
                    Camera.main.transform.position = new Vector3(PLAYER.position.x, PLAYER.position.y, Camera.main.transform.position.z);
                })
                .OnComplete(() => {
                    Camera.main.transform.position = new Vector3(PLAYER.position.x, PLAYER.position.y, Camera.main.transform.position.z);
                });

                PLAYER.DOLocalRotate(new Vector3(0, 0, 180), 0.3f)
                .OnComplete(() => {
                    DOVirtual.DelayedCall(0.3f, () => {
                        guyAnim.DoWalk();

                        DOVirtual.DelayedCall(0.5f, () => {
                            guyAnim.StopAll();
                            spriteDotGameOverZoom.transform.DOScale(Vector3.one * 10, 1)
                            .OnComplete(() => {
                                canvasManager.AnimationCameraGameOver(d.position);
                            });
                        });
                    });
                });
            });
        });
    }
Example #26
0
    //unity 폴더 Resources/Units folder에 UnitType과 똑같은 이름으로 png 또는 jpg file로 존재해야 sprite불러올 수 있음
    public void initiateUnit(UnitType ut, float _x, float _y, PLAYER player)
    {
        if (transform.tag == "Agit")
        {
            control_player = player;
            unitID         = GameManager.GetInstance.giveID();
            if (control_player == PLAYER.PLAYER1)
            {
                GameManager.GetInstance.player1.unitList.Add(this);
                Debug.Log("iniated unit list added");
            }
            else if (control_player == PLAYER.PLAYER2)
            {
                GameManager.GetInstance.player2.unitList.Add(this);
            }
            AgitHP = 300;
            m_unitAttack.InitiateUnitAttack(unitID);
        }
        else
        {
            control_player = player;
            unitType       = ut;
            m_unitData     = GameData.getUnitData(ut);
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Units/" + m_unitData.unitType.ToString());
            this.name = m_unitData.unitType.ToString();
            unitID    = GameManager.GetInstance.giveID();
            GameObject sightRange = transform.Find("SightRange").gameObject;
            Vector3    tempSize   = sightRange.GetComponent <BoxCollider2D>().size;
            sightRange.GetComponent <BoxCollider2D>().size = new Vector3(tempSize.x * unitData.sight * unitData.sight, tempSize.y, 0f);
            if (control_player == PLAYER.PLAYER1)
            {
                GameManager.GetInstance.player1.unitList.Add(this);
                Debug.Log("iniated unit list added");
            }
            else if (control_player == PLAYER.PLAYER2)
            {
                GameManager.GetInstance.player2.unitList.Add(this);
            }
            curHP = unitData.hp;
            m_unitAttack.InitiateUnitAttack(unitID);
            mindamage = unitData.min_atk;
            maxdamage = unitData.max_atk;
            switch (player)
            {
            case PLAYER.PLAYER1:
                break;

            case PLAYER.PLAYER2:
                break;

            case PLAYER.NONE:
                break;

            default:
                break;
            }
            setPos(_x, _y);
        }
    }
Example #27
0
    public void ResetGame()
    {
        hasStarted = true;

        restartButton.SetActive(false);

        turn      = PLAYER.RED;
        redScore  = 0;
        blueScore = 0;

        foreach (ScoreCircle circle in scoreCircles)
        {
            circle.Reset();
        }

        Dictionary <int, int> redIndex = new Dictionary <int, int>();

        foreach (Ball ball in redBalls)
        {
            ball.gameObject.layer = LayerMask.NameToLayer("Red");

            ball.selectable = true;

            ball.GetComponent <SpriteRenderer>().material = matRed;

            if (!redIndex.ContainsKey(ball.type))
            {
                redIndex.Add(ball.type, 0);
            }

            ball.transform.position = redPositions[ball.type].positions[redIndex[ball.type]];

            redIndex[ball.type]++;
        }

        Dictionary <int, int> blueIndex = new Dictionary <int, int>();

        foreach (Ball ball in blueBalls)
        {
            ball.gameObject.layer = LayerMask.NameToLayer("Blue");

            ball.selectable = true;

            ball.GetComponent <SpriteRenderer>().material = matBlue;

            if (!blueIndex.ContainsKey(ball.type))
            {
                blueIndex.Add(ball.type, 0);
            }

            ball.transform.position = bluePositions[ball.type].positions[blueIndex[ball.type]];

            blueIndex[ball.type]++;
        }

        UpdateScore();

        UpdateMessage();
    }
Example #28
0
    public static void SkyDive()
    {
        int     ped = PLAYER.PLAYER_PED_ID();
        Vector3 vec = ENTITY.GET_ENTITY_COORDS(ped, true);

        ENTITY.SET_ENTITY_COORDS(ped, vec.X, vec.Y, 2500f, true, true, true, true);
        AI.TASK_SKY_DIVE(ped);
    }
Example #29
0
    public static int Clone()
    {
        int ped       = PLAYER.PLAYER_PED_ID();
        int pedCloned = PED.CLONE_PED(ped, 1f, false, true);

        MakeHimAsGuard(pedCloned);
        return(pedCloned);
    }
Example #30
0
 void Spawn()
 {
     rb            = GetComponent <Rigidbody>();
     target        = GameObject.FindObjectOfType <PLAYER>();
     moveDirection = (target.transform.position - target.transform.position).normalized * moveSpeed;
     rb.velocity   = new Vector3(moveDirection.x, moveDirection.y, moveDirection.z);
     Destroy(gameObject);
 }
Example #31
0
        private void OnPartyMemberName(Int32 index)
        {
            Int32 partyPlayer = PersistenSingleton <EventEngine> .Instance.GetPartyPlayer(index);

            PLAYER player = _gameState.player[partyPlayer];

            _sb.Append(player.name);
        }
Example #32
0
 // adds points to a given player
 public static void AddPointsExcept(PLAYER player, int points)
 {
     switch (player)
     {
     case PLAYER.PLAYER1:
         AddPoints(PLAYER.PLAYER2, 1);
         AddPoints(PLAYER.PLAYER3, 1);
         AddPoints(PLAYER.PLAYER4, 1);
         break;
     case PLAYER.PLAYER2:
         AddPoints(PLAYER.PLAYER1, 1);
         AddPoints(PLAYER.PLAYER3, 1);
         AddPoints(PLAYER.PLAYER4, 1);
         break;
     case PLAYER.PLAYER3:
         AddPoints(PLAYER.PLAYER1, 1);
         AddPoints(PLAYER.PLAYER2, 1);
         AddPoints(PLAYER.PLAYER4, 1);
         break;
     case PLAYER.PLAYER4:
         AddPoints(PLAYER.PLAYER1, 1);
         AddPoints(PLAYER.PLAYER2, 1);
         AddPoints(PLAYER.PLAYER3, 1);
         break;
     }
 }
Example #33
0
 // adds points to a given player
 public static void AddPoints(PLAYER player, int points)
 {
     switch (player)
     {
     case PLAYER.PLAYER1:
         Player1Points += points;
         break;
     case PLAYER.PLAYER2:
         Player2Points += points;
         break;
     case PLAYER.PLAYER3:
         Player3Points += points;
         break;
     case PLAYER.PLAYER4:
         Player4Points += points;
         break;
     }
 }
Example #34
0
 public static bool GetButtonJustReleased(PLAYER player, BUTTON button)
 {
     return Input.GetKeyUp(GetKeycode(player, button));
 }
Example #35
0
 public static bool GetButtonPressed(PLAYER player, BUTTON button)
 {
     return Input.GetKey(GetKeycode(player, button));
 }
Example #36
0
 public static int GetPoints(PLAYER player)
 {
     switch (player)
     {
     case PLAYER.PLAYER1:
         return Player1Points;
     case PLAYER.PLAYER2:
         return Player2Points;
     case PLAYER.PLAYER3:
         return Player3Points;
     case PLAYER.PLAYER4:
         return Player4Points;
     }
     return 0;
 }
Example #37
0
 private static KeyCode GetKeycode(PLAYER player, BUTTON button)
 {
     KeyCode key = KeyCode.Space;
     switch(player)
     {
     case PLAYER.PLAYER1:
         switch(button)
         {
         case BUTTON.A:
             key = KeyCode.Z;
             break;
         case BUTTON.B:
             key = KeyCode.X;
             break;
         case BUTTON.LEFT:
             key = KeyCode.LeftArrow;
             break;
         case BUTTON.RIGHT:
             key = KeyCode.RightArrow;
             break;
         case BUTTON.UP:
             key = KeyCode.UpArrow;
             break;
         case BUTTON.DOWN:
             key = KeyCode.DownArrow;
             break;
         }
         break;
     case PLAYER.PLAYER2:
         switch(button)
         {
         case BUTTON.A:
             key = KeyCode.N;
             break;
         case BUTTON.B:
             key = KeyCode.M;
             break;
         case BUTTON.LEFT:
             key = KeyCode.J;
             break;
         case BUTTON.RIGHT:
             key = KeyCode.L;
             break;
         case BUTTON.UP:
             key = KeyCode.I;
             break;
         case BUTTON.DOWN:
             key = KeyCode.K;
             break;
         }
         break;
     case PLAYER.PLAYER3:
         switch(button)
         {
         case BUTTON.A:
             key = KeyCode.Q;
             break;
         case BUTTON.B:
             key = KeyCode.E;
             break;
         case BUTTON.LEFT:
             key = KeyCode.A;
             break;
         case BUTTON.RIGHT:
             key = KeyCode.D;
             break;
         case BUTTON.UP:
             key = KeyCode.W;
             break;
         case BUTTON.DOWN:
             key = KeyCode.S;
             break;
         }
         break;
     case PLAYER.PLAYER4:
         switch(button)
         {
         case BUTTON.A:
             key = KeyCode.R;
             break;
         case BUTTON.B:
             key = KeyCode.Y;
             break;
         case BUTTON.LEFT:
             key = KeyCode.F;
             break;
         case BUTTON.RIGHT:
             key = KeyCode.H;
             break;
         case BUTTON.UP:
             key = KeyCode.T;
             break;
         case BUTTON.DOWN:
             key = KeyCode.G;
             break;
         }
         break;
     }
     return key;
 }
Example #38
0
 // adds points to a given player
 public static void AddPoints(PLAYER player, int points)
 {
     switch (player)
     {
     case PLAYER.PLAYER1:
         if (Player1Points + points <= SCORE_LIMIT)
             Player1Points += points;
         break;
     case PLAYER.PLAYER2:
         if (Player2Points + points <= SCORE_LIMIT)
             Player2Points += points;
         break;
     case PLAYER.PLAYER3:
         if (Player3Points + points <= SCORE_LIMIT)
             Player3Points += points;
         break;
     case PLAYER.PLAYER4:
         if (Player4Points + points <= SCORE_LIMIT)
             Player4Points += points;
         break;
     }
 }
Example #39
0
 // adds points to a given player
 public static void ResetPoints(PLAYER player)
 {
     switch (player)
     {
     case PLAYER.PLAYER1:
         Player1Points = 0;
         AddPointsExcept(PLAYER.PLAYER1, 1);
         break;
     case PLAYER.PLAYER2:
         Player2Points = 0;
         AddPointsExcept(PLAYER.PLAYER2, 1);
         break;
     case PLAYER.PLAYER3:
         Player3Points = 0;
         AddPointsExcept(PLAYER.PLAYER3, 1);
         break;
     case PLAYER.PLAYER4:
         Player4Points = 0;
         AddPointsExcept(PLAYER.PLAYER4, 1);
         break;
     }
 }