Inheritance: MonoBehaviour
Exemple #1
0
 public CurrentMoves(Gameplay.MoveState[] moves)
 {
     this.moves = new int[moves.Length];
     for (int i = 0; i < moves.Length; i++) {
         this.moves[i] = moves[i].MoveNum;
     }
 }
    public bool CanSetItem(Gameplay.EquipmentSlotType Slot, GameplayItem Item)
    {
        //Check if this slot is locked by other item
        if (Slot < Gameplay.EquipmentSlotType._COUNT)
        {
            if (Slots[(int)Slot].LockedByOtherSlot)
            {
                return false;
            }
        }

        //Check generics
        if (Item.Slot == Gameplay.EquipmentSlotType.HAND || Item.Slot == Gameplay.EquipmentSlotType.LEFT_RIGHT_HAND)
        {
            if (Slot == Gameplay.EquipmentSlotType.LEFT_HAND)
                return true;
            if (Slot == Gameplay.EquipmentSlotType.RIGHT_HAND)
                return true;
        }
        else if (Item.Slot == Gameplay.EquipmentSlotType.FINGER || Item.Slot == Gameplay.EquipmentSlotType.LEFT_RIGHT_FINGER)
        {
            if (Slot == Gameplay.EquipmentSlotType.LEFT_FINGER)
                return true;
            if (Slot == Gameplay.EquipmentSlotType.RIGHT_FINGER)
                return true;
        }

        return Slot == Item.Slot;
    }
Exemple #3
0
    /// <summary>
    /// Disables certain functionalities and sets card identity based on whether it is a server or a client
    /// </summary>
	void Start () {
        //Disable Card button functionality for client
	    if (!transform.GetComponent<NetworkIdentity>().isServer)
	    {
	        this.transform.GetChild(0).GetChild(0).GetComponent<Button>().interactable = false;
	    }

        //grab references
	    gameplay = GameObject.Find("BoardGenerator").GetComponent<Gameplay>();

        //set renderer color for master spy
	    if (!transform.GetComponent<NetworkIdentity>().isServer)
	    {
	        switch (CardType)
	        {
	            case 0:
	                break;
	            case 1:
	                GetComponent<Renderer>().material.color = new Color(1, 0, 0);
	                break;
	            case 2:
	                GetComponent<Renderer>().material.color = new Color(0, 0, 1);
	                break;
	            case 4:
	                GetComponent<Renderer>().material.color = new Color(0, 0, 0);
	                break;
	        }
	    }
	    //set text
	    transform.GetChild(0).GetChild(0).GetComponentInChildren<Text>().text = Word;
	}
    void Start()
    {
        Game = (Gameplay)GameObject.FindGameObjectWithTag("MainCamera").GetComponent("Gameplay");

        //Game.GameChat.AddChatMessage("ADMIN2", "Setting Pos: " + pos);
        //gameObject.transform.position = Game.field.fieldInfo.GetPosition((int)pos);
    }
    public EnemyField(Gameplay _Game)
    {
        CriticalLeft = GameObject.FindGameObjectWithTag("EnemyCriticalFrontLeft");
        CriticalVanguard = GameObject.FindGameObjectWithTag("EnemyCriticalVanguard");
        CriticalRight = GameObject.FindGameObjectWithTag("EnemyCriticalFrontRight");

        CallEffect = GameObject.FindGameObjectWithTag("CallEffect");

        fieldInfo = new EnemyFieldInformation();
        Soul      = new List<Card>();
        Vanguard  = null;
        Left_Rear = null;
        Left_Front = null;
        Center_Rear = null;
        Right_Rear = null;
        Left_Rear = null;
        delta     = new Vector3(0.0f, 0.01f, 0.0f);

        VanguardPower   = (TextMesh)GameObject.FindGameObjectWithTag("VPEnemy").GetComponent("TextMesh");
        FrontRightPower = (TextMesh)GameObject.FindGameObjectWithTag("FRPEnemy").GetComponent("TextMesh");
        FrontLeftPower  = (TextMesh)GameObject.FindGameObjectWithTag("FLPEnemy").GetComponent("TextMesh");
        RearRightPower  = (TextMesh)GameObject.FindGameObjectWithTag("RRPEnemy").GetComponent("TextMesh");
        RearLeftPower   = (TextMesh)GameObject.FindGameObjectWithTag("RLPEnemy").GetComponent("TextMesh");
        RearCenterPower = (TextMesh)GameObject.FindGameObjectWithTag("RCPEnemy").GetComponent("TextMesh");

        VC  = (TextMesh)GameObject.FindGameObjectWithTag("VCE").GetComponent("TextMesh");
        FRC = (TextMesh)GameObject.FindGameObjectWithTag("FRCE").GetComponent("TextMesh");
        FLC = (TextMesh)GameObject.FindGameObjectWithTag("FLCE").GetComponent("TextMesh");
        RRC = (TextMesh)GameObject.FindGameObjectWithTag("RRCE").GetComponent("TextMesh");
        RLC = (TextMesh)GameObject.FindGameObjectWithTag("RLCE").GetComponent("TextMesh");
        RCC = (TextMesh)GameObject.FindGameObjectWithTag("RCCE").GetComponent("TextMesh");

        VanguardPower.text    = "";
        FrontRightPower.text  = "";
        FrontLeftPower.text   = "";
        RearRightPower.text   = "";
        RearLeftPower.text    = "";
        RearCenterPower.text  = "";

        DamageZone = new List<Card>();
        DropZone   = new List<Card>();
        BindZone   = new List<Card>();

        VanguardPower.renderer.material.color   = Color.yellow;
        FrontRightPower.renderer.material.color = Color.yellow;
        FrontLeftPower.renderer.material.color  = Color.yellow;
        RearRightPower.renderer.material.color  = Color.yellow;
        RearLeftPower.renderer.material.color   = Color.yellow;
        RearCenterPower.renderer.material.color = Color.yellow;

        VC.text = "";
        FRC.text = "";
        FLC.text = "";
        RRC.text = "";
        RLC.text = "";
        RCC.text = "";

        Game = _Game;
    }
 void Awake()
 {
     enemyAssociated = transform.GetComponent<Enemy>();
     capteur = new Ray(Vector3.zero, Vector3.zero);
     if(!Application.loadedLevelName.Contains("Editor")) gameplay = GameObject.Find("Engine").GetComponent<Gameplay>();
     PSDetection = transform.FindChild("PSDetection").gameObject;
     discoverHero = false;
 }
 public PowerupManager(World world, Gameplay.GameplayScreen screen)
 {
     types = new[] { typeof(ScatterBomb) };
     phyWorld = world;
     gameplay = screen;
     rand = new Random();
     remaining = rand.NextDouble() * 10 + 10;
 }
Exemple #8
0
 // Use this for initialization
 void Start()
 {
     theCanon = transform.parent.GetComponent<Canon>();
     pointLight = transform.FindChild("Light").light;
     lensFlare = transform.GetComponentInChildren<LensFlare>();
     ps = transform.FindChild("PS").particleSystem;
     time = 0f;
     if(!Application.loadedLevelName.Contains("Editor") && !Application.loadedLevelName.Contains("MainMenu") ) gameplay = GameObject.Find("Engine").GetComponent<Gameplay>();
 }
    public CardMenu(Gameplay Game)
    {
        _Game = Game;
        OptionNormal = Resources.Load ("CardMenuNormal") as Texture2D;
        OptionSelected = Resources.Load("CardMenuSelected") as Texture2D;

        _w = 285.0f * 0.24f;
        _h = 43.0f * 0.45f;
        optionNames = new List<string>();
        function = new List<ClickFunction>();

        _Camera = (Camera)GameObject.FindGameObjectWithTag("MainCamera").GetComponent("Camera");
    }
        public override void DoReset(Gameplay.Abstracts.GameObject.ResetInformation resetInformation)
        {
            Inventory inventory = InventoryComp.Inventory;

            try
            {
                // Stops the case from deleting inventory content on reset
                InventoryComp.Inventory = null;

                base.DoReset(resetInformation);
            }
            finally
            {
                InventoryComp.Inventory = inventory;
            }
        }
Exemple #11
0
    /// <summary>
    /// Custom update function that can be turned on and off. Had to be done this way instead of a regular update due to unity player-spawning in networking.
    /// </summary>
    /// <returns></returns>
    public IEnumerator UiRefresh()
    {
        //grab reference and set max amounts of cards for both teams
        gameplay = GameObject.Find("BoardGenerator").GetComponent<Gameplay>();
        int maxRed = gameplay.StartingTeam == 0 ? 9 : 8;
        int maxBlue = gameplay.StartingTeam == 1 ? 9 : 8;

        //Display which team starts + their current amount of cards
        while (true)
        {
            statusText.text = gameplay.StartingTeam == 0 ? "RED STARTS" : "BLUE STARTS";
            redCounter.text = gameplay.ScoreRed+"/"+ maxRed;
            blueCounter.text = gameplay.ScoreBlue+"/"+maxBlue;
            yield return new WaitForEndOfFrame();
        }
    }
    public FieldWatcher(Gameplay _game)
    {
        game = _game;
        backgroundTexture = Resources.Load("ViewCardBackground") as Texture2D;

        exitBtnStyle.normal.background = Resources.Load("GUI/exit") as Texture2D;
        exitBtnStyle.hover.background  = Resources.Load("GUI/exit_hover") as Texture2D;

        leftArrowBtnStyle.normal.background = Resources.Load("GUI/left_arrow") as Texture2D;
        leftArrowBtnStyle.hover.background  = Resources.Load("GUI/left_arrow_hover") as Texture2D;

        rightArrowBtnStyle.normal.background = Resources.Load("GUI/right_arrow") as Texture2D;
        rightArrowBtnStyle.hover.background  = Resources.Load("GUI/right_arrow_hover") as Texture2D;

        Reset();
    }
Exemple #13
0
    // Use this for initialization
    void Start()
    {
        btnWidth = 80;
        btnHeight = 30;
        groupWidth = 100;
        groupHeight = 300;
        groupX = Screen.width - groupWidth;
        groupY = Screen.height/2 - groupHeight/2;
        menuBtnX = 10;
        menuBtnY = 40;
        groupWidth2 = 300;
        groupHeight2 = 75;
        groupX2 = Screen.width/3 - groupWidth2/2;
        groupY2 = Screen.height - groupHeight2;

        gameplay = Gameplay.instance;
    }
Exemple #14
0
    public Deck(Gameplay game)
    {
        cards = new List<Card>();
        fieldInfo = new FieldInformation();
        CardSelectedVector = new List<CardIdentifier>();

        initialPositionShowDeck = new Vector3(-15.43038f, 3.943099f, -18.63872f);
        deltaPositionShowDeck   = new Vector3(0.625f, 0.0f, 0.001f);

        Cursor = GameObject.FindGameObjectWithTag("Cursor");

        bShowingDeck = false;
        currentCard = 0;

        ViewBackground = Resources.Load ("ViewCardBackground") as Texture2D;

        CardsWatching = new List<Game2DCard>();
        TotalCards = new List<Game2DCard>();
        _Game = game;
    }
    public List<Gameplay.EquipmentSlotType> CheckItemSlots(Gameplay.EquipmentSlotType DstSlot, GameplayItem Item)
    {
        List<Gameplay.EquipmentSlotType> List = new List<Gameplay.EquipmentSlotType>();
        //Check generics
        if (Item.Slot == Gameplay.EquipmentSlotType.LEFT_RIGHT_HAND)
        {
            List.Add(Gameplay.EquipmentSlotType.RIGHT_HAND);
            List.Add(Gameplay.EquipmentSlotType.LEFT_HAND);
        }
        else if (Item.Slot == Gameplay.EquipmentSlotType.LEFT_RIGHT_FINGER)
        {
            List.Add(Gameplay.EquipmentSlotType.LEFT_FINGER);
            List.Add(Gameplay.EquipmentSlotType.RIGHT_FINGER);
        }
        /*else if(Item.Slot == Gameplay.EquipmentSlotType.HAND)
        {
            if((DstSlot == Gameplay.EquipmentSlotType.LEFT_HAND || DstSlot == Gameplay.EquipmentSlotType.RIGHT_HAND) &&
                !Slots[(int)DstSlot].LockedByOtherSlot)
            {
                List.Add(DstSlot);
            }
        }
        else if(Item.Slot == Gameplay.EquipmentSlotType.FINGER)
        {
            if((DstSlot == Gameplay.EquipmentSlotType.LEFT_FINGER || DstSlot == Gameplay.EquipmentSlotType.RIGHT_FINGER) &&
                !Slots[(int)DstSlot].LockedByOtherSlot)
            {
                List.Add(DstSlot);
            }
        }
        else if(!Slots[(int)DstSlot].LockedByOtherSlot)
        {
            List.Add(DstSlot);
        }*/

        return List;
    }
Exemple #16
0
	void Awake () {
        instance = this;
        gamePlayPhotonView = PhotonView.Get(this);
        spawnedList = new List<GameObject>();
        


        //Finding GameObjects
        rightPlayerText = GameObject.Find("RightPlayerText").gameObject.GetComponent<Text>();
        leftPlayerText = GameObject.Find("LeftPlayerText").gameObject.GetComponent<Text>();
        pointsLeft = GameObject.Find("PointsLeft").gameObject.GetComponent<Text>();
        pointsRight = GameObject.Find("PointsRight").gameObject.GetComponent<Text>();
        pointsLeft.text = "Points: 0";
        pointsRight.text = "Points: 0";


        playersInRoom = false;
        gameStart = false;
        gameStarted = false;
        gameOver = false;
        timer = 3;
        currentPointsLeft = currentPointsRight = 0;
        maxPoints = 5;
    }
Exemple #17
0
 public GameplayStateStart(Gameplay gameplay) : base(gameplay)
 {
 }
 public ScatterBomb(World world, Gameplay.GameplayScreen screen, Random rand)
     : base(world, screen, rand)
 {
     random = rand;
 }
Exemple #19
0
 private void Awake()
 {
     current = this;
 }
 protected void _se_PlayerWon(Gameplay.Player p)
 {
     Dispatcher.Invoke(new playerUpdateHandler(updatePlayerWon), p, string.Empty);
 }
 public void SetGame(Gameplay game)
 {
     this.Game = game;
 }
 void CreateGrid(Gameplay.ItemType Type)
 {
     CreateEmptyGrid();
     switch(Type)
     {
         case Gameplay.ItemType.WEAPON: CreateWeaponGrid(); break;
     }
 }
 public void SetGame(Gameplay _Game)
 {
     CallFromDeckList = new List<Card>();
     Game = _Game;
 }
Exemple #24
0
 public override void Leave()
 {
     Gameplay.SetStartScreenVisible(false);
 }
Exemple #25
0
 public GameplayStatePlay(Gameplay gameplay) : base(gameplay)
 {
 }
Exemple #26
0
 public void RZone(Gameplay gp)
 {
     Assert.IsTrue(gp.Replay(new Always(G => G.packs.TrueForAll(CorrectZone))));
 }
Exemple #27
0
 public override void BackButtonPressed()
 {
     Gameplay.Pause();
 }
Exemple #28
0
 void Awake()
 {
     GP = GameObject.Find("Gameplay").GetComponent <Gameplay>();
 }
 // Use this for initialization
 void Awake()
 {
     if(!Application.loadedLevelName.Contains("Editor")) gameplay = GameObject.Find("Engine").GetComponent<Gameplay>();
 }
Exemple #30
0
 public void PlayerHpAbove0(Gameplay gp)
 {
     Assert.IsTrue(gp.Replay(new Always(G => G.player.HP >= 0)));
 }
 public void SetGame(Gameplay _game)
 {
     game = _game;
 }
 private void updatePlayerLeft(Gameplay.Player player, string msg = "")
 {
     if (getCurrentControl() == _intro)
     {
         _players--;
         _intro.Players = _players;
     }
 }
 public CItemGrid(Gameplay.ItemType Type)
 {
     InitializeComponent();
     CreateGrid(Type);
 }
 protected void ClientHandler_PlayerLeft(Gameplay.Player player, string msg = "")
 {
     Dispatcher.Invoke(new playerUpdateHandler(updatePlayerLeft), player, msg);
 }
 private void Start()
 {
     gameplay = FindObjectOfType <Gameplay>();
     sd       = gameplay.GetSaveData();
 }
Exemple #36
0
 public static GameplayController Create(Gameplay gameplay)
 {
     return(new InfiniteGameplayController(gameplay));
 }
Exemple #37
0
 // Start is called before the first frame update
 void Start()
 {
     m_GP = GameObject.Find("Gameplay").GetComponent <Gameplay>();
 }
Exemple #38
0
 void Awake()
 {
     Gameplay.instance = this;
 }
 // Do the actual updating
 private void updatePlayerJoined(Gameplay.Player p,string msg)
 {
     if (getCurrentControl() == _intro)
     {
         _players++;
         _intro.Players = _players;
     }            
 }
    // Use this for initialization
    void Start()
    {
        #region 处理其他UI
        _battleMapBlockAndUnits = GameObject.Find("MainPanel");
        _roundStateText         = GameObject.Find("phaseNameText");

        _uiToHide = new List <GameObject>();

        _uiToHide.Add(_battleMapBlockAndUnits);
        _uiToHide.Add(_roundStateText);
        #endregion

        #region 获取卡牌管理器上相应列表引用
        handcardList         = CardManager.Instance().cardsInHand;
        cardSetsList         = CardManager.Instance().cardsSets;
        cooldownList         = CardManager.Instance().cooldownCards;
        handcardInstanceList = CardManager.Instance().handcardsInstance;
        #endregion

        // 卡牌书界面内关闭按钮事件监听
        _closeWindowButton.onClick.Add(ShowCardBook);

        // 回合结束按钮添加事件监听
        _endRoundButton.onClick.Add(Gameplay.Instance().switchPhaseHandler);

        // 卡牌堆按钮添加事件监听
        _cardSetsButton.onClick.Add(ShowCardBook);

        _handcardList.childrenRenderOrder = ChildrenRenderOrder.Arch;

        MsgDispatcher.RegisterMsg(
            this.GetMsgReceiver(),
            (int)MessageType.HandcardChange,
            () => { return(true); },
            UpdateHandcards,
            "Hand cards observer"
            );

        MsgDispatcher.RegisterMsg(
            this.GetMsgReceiver(),
            (int)MessageType.CardsetChange,
            () => { return(true); },
            UpdateCardsSets,
            "Card sets observer"
            );

        MsgDispatcher.RegisterMsg(
            this.GetMsgReceiver(),
            (int)MessageType.CooldownlistChange,
            () => { return(true); },
            UpdateCooldownList,
            "Cooldown list observer"
            );

        UpdateHandcards();
        UpdateCardsSets();
        UpdateCooldownList();

        _handcardList.onClickItem.Add(OnClickHandCard);

        _cardsSetsList.onClickItem.Add(OnClickCardInCardSets);
    }
 private void updatePlayerWon(Gameplay.Player player, string msg = "")
 {
     if (player != null)
     {
         initWinScreen(player.Image);
         _wintimer.Start();
     }
 }
Exemple #42
0
 public NpcSprite(Loc2D charLoc, Direction8 charDir, Gameplay.FormData data)
     : base(charLoc, charDir)
 {
     CharData = data;
 }
Exemple #43
0
 public void Descend()
 {
     Gameplay.Instance().NextLevel();
     hasFloorKey = false;
 }
    /// <summary>
    /// 响应手牌点击事件的函数
    /// </summary>
    public void OnClickHandCard(EventContext context)
    {
        // 如果不是玩家回合,则无法使用卡牌
        if (!Gameplay.Instance().roundProcessController.IsPlayerRound())
        {
            return;
        }

//		int index = _handcardList.GetChildIndex(context.data as GObject);
//		BaseCard baseCardReference = handcardInstanceList[index].GetComponent<BaseCard>();
//		if (!Player.Instance().CanConsumeAp(baseCardReference.cost))
//		{
//			Debug.Log("Ran out of AP, cant use this one");
//			return;
//		}

        GObject item = context.data as GObject;

        // 确认当前点击的卡牌和上次点击的不同,此时表明用户想使用这张卡牌
        if (item != lastClicked)
        {
            // 改变记录
            lastClicked = item;
            // 动效
            //DoSpecialEffect(item);
            // 设置当前选中的卡牌
            CardManager.Instance().SetSelectingCard(_handcardList.GetChildIndex(item));
        }
        else         // 此时用户点击的牌和上次相同,表示用户想取消使用
        {
            // 恢复原大小
            foreach (GObject litem in _handcardList.GetChildren())
            {
                StartCoroutine(FancyHandCardEffect(litem, 1));
            }

            // 重置上次选择项
            lastClicked = null;

            // 调用取消使用方法
            CardManager.Instance().CancleUseCurrentCard();

            // 结束函数执行,因为用户取消使用
            return;
        }

        CardManager.Instance().OnUseCurrentCard();

//		// 若是效果牌
//		if (baseCardReference.type.Equals("Order"))
//		{
////			// 判断使用结果
////			if (baseCardReference.Use())
////			{
////				// 使用成功则移除手牌
////				CardManager.Instance().RemoveCardToCd(index);
////				return;
////			}
//
//			baseCardReference.Use();
//
//		}
//		else
//		{
//			if (Gameplay.Instance().gamePlayInput.IsSelectingCard == false)
//			{
//				Gameplay.Instance().gamePlayInput. OnPointerDownUnitCard(handcardInstanceList[index]);
//				BattleMap.BattleMap.Instance().IsColor = true;
//			}
//		}
    }