示例#1
0
    public void ReceiveNPCAction(int x, int y, int index, ActionType action, int data)
    {
        IndividualCard card = null;

        try {
            if (x != -1 && y != -1)
            {
                card = CardHandler.s.allCards[x, y];
            }
        } catch {
            DataLogger.LogError("ReceiveNPCAction couldnt find the card " + x.ToString() + "-" + y.ToString());
        }

        try {
            NPCBase myNPC = null;
            if (action != ActionType.Spawn)
            {
                myNPC = ActiveNPCS[index];
            }

            switch (action)
            {
            case ActionType.Spawn:
                DataLogger.LogError("Customs NPCs are not implemented to spawn yet! Spawning default level npc");
                myNPC = SpawnNPCAtLocation(card, GS.a.myNPCPrefab);
                ActiveNPCS.SetIndex(index, myNPC);
                break;

            case ActionType.Die:
            case ActionType.SelectCard:
            case ActionType.Activate:
            case ActionType.GoToPos:
                myNPC.ReceiveNPCAction(card, action, data);
                break;

            default:
                DataLogger.LogError("Unrecognized power up action PUF");
                break;
            }
        } catch (System.Exception e) {
            DataLogger.LogError(this.name, e);
        }
    }