示例#1
0
 /// <summary>
 /// human player
 /// </summary>
 /// <param name="character">his character</param>
 public GameNPC(Game.GameLogic logic, CharacterNPC character)
 {
     this.character = character;
     this.direction = new Vector3(1, 0, 0);
     this.logic     = logic;
     this.logic.Ai.AddPlayer(this, character);
 }
示例#2
0
        /// <summary>
        /// human player do some action
        /// </summary>
        /// <param name="action">action from input</param>
        /// <param name="dir">direction where is player looking</param>
        internal void Spell(Input.Action action, Microsoft.DirectX.Vector3 dir)
        {
            switch (action)
            {
            case Input.Action.Action1:
                //at action button send fireball
                this.fireballInfo.startPosition  = this.camera.GetVector3Position();
                this.fireballInfo.targetPosition = this.camera.GetVector3Position() + dir;
                CharacterNPC playerChar = this.ai.GetPlayerInfo().Character;

                ActionInfo info = this.fireballInfo;
                info.action.enemyHpTaken += playerChar.level * playerChar.power;

                if (ai.AcceptPlayerAction(info))
                {
                    CreateFireball(info);
                }
                break;

            case Input.Action.Action2:
                break;

            case Input.Action.Action3:
                break;

            case Input.Action.Wheel:
                break;

            default:
                break;
            }
        }
示例#3
0
    public void Inspecionar()
    {
        //  Debug.LogError("interagindo asdasd");

        if (inspencionado.transform.tag == "Personagens")
        {
            //      Debug.LogError("interagindo personagem");
            acompanhante = inspencionado.GetComponent <CharacterNPC>();

            if (acompanhante != null)
            {
                acompanhante.chamarCanvasMissao();
            }
            else
            {
                var npcConversar = inspencionado.GetComponent <InformacaoPerosonagem>();
                if (npcConversar != null)
                {
                    npcConversar.Conversar();
                }
            }
        }
        else if (inspencionado.transform.tag == "ItemInformativo")
        {
            information = inspencionado.GetComponent <InformationItem>();
            information.ExibirInformativoTP();
        }
    }
    public override IEnumerator StartAction(CharacterNPC npc)
    {
        if (oldNPC == npc)
        {
            if (reverse && currentPointIndex <= 0)
            {
                currentPointIndex = 0;
                reverse           = false;
            }
            else if (!reverse && currentPointIndex >= point.Length - 1)
            {
                currentPointIndex = point.Length - 1;
                reverse           = true;
            }
        }
        else
        {
            currentPointIndex = 0;
            reverse           = false;
        }

        oldNPC = npc;

        yield return(base.StartAction(npc));
    }
示例#5
0
    public virtual IEnumerator StartAction(CharacterNPC npc)
    {
        this.npc = npc;
        finish   = false;
        DoLogic();

        while (!finish)
        {
            yield return(null);
        }
    }
    public override void execute()
    {
        Character    character = (mReceiver) as Character;
        CharacterNPC npc       = character as CharacterNPC;

        npc.reorderMahjong();
        // 通知布局麻将被重新排列
        CharacterData       data   = npc.getCharacterData();
        ScriptMahjongHandIn handIn = mLayoutManager.getScript(LAYOUT_TYPE.LT_MAHJONG_HAND_IN) as ScriptMahjongHandIn;

        handIn.notifyReorder(data.mPosition, data.mHandIn);
    }
示例#7
0
        public void RegisterDeadNpc(GameNPC gameNpc, CharacterNPC character)
        {
            if (character.type == NPCType.guard)
            {
                Timer t = new Timer();
                t.AutoReset = false;
                t.Interval  = RespawnInterval * 1000;
                t.Elapsed  += new ElapsedEventHandler(respawn_Elapsed);
                t.Start();

                this.respawnTimers.Add(t);
                this.deadGuards.Add(gameNpc);
            }
        }
示例#8
0
        /// <summary>
        /// WiccanRede.AI controlled npc with script
        /// </summary>
        /// <param name="character">his character</param>
        /// <param name="logic"> GameLogic object - used for interaction, respawn, etc, contains AICore object</param>
        /// <param name="position">absolute position on map</param>
        /// <param name="scriptPath">path to the script file</param>
        public GameNPC(CharacterNPC character, Game.GameLogic logic, string scriptPath, Vector3 position)
        {
            this.ai               = logic.Ai;
            this.logic            = logic;
            this.character        = character;
            this.position         = position;
            this.scriptPath       = scriptPath;
            this.actionDefinition = "";
            this.direction        = new Vector3(1, 0, 0);

            JoinToGraphic(character);

            logic.Ai.AddPlayer(character, position, this, scriptPath);
        }
示例#9
0
        //IWalkable terrain;


        //static List<GameNPC> players = new List<GameNPC>();

        /// <summary>
        /// WiccanRede.AI controlled npc
        /// </summary>
        /// <param name="character">his character</param>
        /// <param name="logic">GameLogic object - used for interaction, respawn, etc, contains AICore object</param>
        /// <param name="position">absolute position on map</param>
        /// <param name="fsmName">name of FSM plug-in which will be loaded for this NPC</param>
        /// <param name="actionDefinition">name of config xml file with definitions of actions</param>
        public GameNPC(CharacterNPC character, Game.GameLogic logic, string fsmName, Vector3 position, string actionDefinition)
        {
            this.ai               = logic.Ai;
            this.logic            = logic;
            this.character        = character;
            this.position         = position;
            this.fsmName          = fsmName;
            this.actionDefinition = actionDefinition;
            this.direction        = new Vector3(1, 0, 0);

            JoinToGraphic(character);

            logic.Ai.AddPlayer(character, position, this, fsmName, actionDefinition);
        }
示例#10
0
        private void JoinToGraphic(CharacterNPC character)
        {
            SceneManager sceneManager = Graphics.GraphicCore.GetCurrentSceneManager();

            player = sceneManager.GetObject(character.name).generalObject as Player;

            if (player.HaveHand())
            {
                player.EquipItem(sceneManager.GetObject(character.name + "_Pochoden").generalObject);
            }

            Matrix world = player.GetMatrixWorld();

            position = new Vector3(world.M41, world.M42, world.M43) * (1f / world.M44);
            ChangePosition(position);
        }
    private IEnumerator TryDamage(CharacterNPC verifyNpc)
    {
        yield return(new WaitForSeconds(delayToDamage));

        int collisionCount = Physics.OverlapSphereNonAlloc(m_collider.transform.position, m_collider.radius, others, layer);

        if (collisionCount > 0)
        {
            for (int i = 0; i < collisionCount; i++)
            {
                var post_npc = others[i].gameObject.GetComponent <CharacterNPC>();
                if (post_npc)
                {
                    if (post_npc == verifyNpc)
                    {
                        verifyNpc.TryDamage(this);
                        break;
                    }
                }
            }
        }

        tryingDamage.Remove(verifyNpc);
    }
示例#12
0
        public Platform(Canvas xScene)//constroi o cenario, com os tiles e os canvas
        {
            chunck = new Canvas();
            xScene.Children.Add(chunck);
            System.IO.StreamReader file = new System.IO.StreamReader("Assets/Scripts/Scenes/scenario2.txt");
            string bp;
            int    sizeX = 0;
            int    sizeY = 0;

            while ((bp = file.ReadLine()) != null)
            {
                Blueprint.Add(bp);
                sizeX = sizeX <= bp.Length ? bp.Length : sizeX;
                sizeY++;
            }
            file.Close();
            chunck.Width  = (sizeX - 1) * Matriz.scale;
            chunck.Height = sizeY * Matriz.scale + Tile.VirtualSize[1] - Matriz.scale;
            Solid leftWall  = new Solid(-20, 0, 20, chunck.Height);
            Solid rightWall = new Solid(chunck.Width, 0, 20, chunck.Height);

            floor.Add(leftWall);
            floor.Add(rightWall);
            //Map = new int[Blueprint.Count, 1000];
            for (int y = Blueprint.Count - 1; y >= 0; y--)
            {
                int x = 0;
                foreach (char block in Blueprint[y])
                {
                    if (block == 'p')
                    {
                        CreatePlayer(xScene, x, y);
                        //Map[y, x] = 1;
                        break;
                    }
                    x++;
                }
            }
            for (int y = Blueprint.Count - 1; y >= 0; y--)
            {
                int x = 0;
                foreach (char block in Blueprint[y])
                {
                    switch (block)
                    {
                    case '-': break;

                    case 'g':
                    case 'o':
                        Tile ground = new Tile(Tile.TileCode[block], x, y);
                        SetImage(ground.Path, Tile.VirtualSize[0], Tile.VirtualSize[1],
                                 ground.VirtualPosition[0], ground.VirtualPosition[1]);
                        break;

                    case 'G':
                    case 'O':
                        Tile grass = new Tile(Tile.TileCode[block], x, y);
                        SetImage(grass.Path, Tile.VirtualSize[0], Tile.VirtualSize[1],
                                 grass.VirtualPosition[0], grass.VirtualPosition[1]);
                        Block blk = new Block(Matriz.scale * x, Matriz.scale * y - 1);
                        //chunck.Children.Add(solid);
                        //floor.Add(solid);
                        //solid.Background = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0));
                        break;

                    case 'b':
                        Solid chest = InterfaceManager.instance.CreateChest(x * Tile.Size[0], y * Tile.Size[1], baus[a], Tile.Size[0], Tile.Size[1]);
                        a++;
                        floor.Add(chest);
                        break;

                    case 'm':
                        CreateMob(xScene, x, y);
                        break;

                    case 'n':
                        //new CharacterNPC()
                        n++;
                        NPC          np  = CreateNPCPhase(1, n);
                        CharacterNPC npc = new CharacterNPC(np, x * Matriz.scale, y * Matriz.scale, Matriz.scale, Matriz.scale * 2, 0);
                        floor.Add(npc.box);
                        break;

                    case 'N':
                        Tile neve = new Tile(Tile.TileCode[block], x, y);
                        SetImage(neve.Path, Tile.VirtualSize[0], Tile.VirtualSize[1],
                                 neve.VirtualPosition[0], neve.VirtualPosition[1]);
                        Block blkn = new Block(Matriz.scale * x, Matriz.scale * y - 1);
                        break;

                    case 'L':
                        Tile lava = new Tile(Tile.TileCode[block], x, y);
                        SetImage(lava.Path, Tile.VirtualSize[0], Tile.VirtualSize[1],
                                 lava.VirtualPosition[0], lava.VirtualPosition[1]);
                        Block blkl = new Block(Matriz.scale * x, Matriz.scale * y - 1);
                        break;

                    case 'P':
                        InterfaceManager.instance.CreatePortal(x * Matriz.scale, y * Matriz.scale, "");
                        break;

                    default: break;
                    }
                    x++;
                }
            }
        }
示例#13
0
 public void OnGazeNPCEnter(CharacterNPC npc)
 {
     //vrCanvas.SetItemInfo(item);
 }
示例#14
0
        /// <summary>
        /// For DEBUGGING
        /// </summary>
        private void LoadTests()
        {
            // DEBUG:  Create NPCs for testing
            for (int i = 0; i < 3; i++)
            {
                CharacterNPC npc = new CharacterNPC(contents.Load<CharacterNPC>("TestNPC"));
                npc.Sprite.ScreenCenter = ChronosSetting.WindowSize / 2;
                npc.MapPosition = new Point(rand.Next(1, 10), rand.Next(1, 10));
                npc.Position =
                    new Vector2(npc.MapPosition.X * mapInfo.TileWidth - (npc.Sprite.FrameDimension.X - mapInfo.TileWidth),
                                    npc.MapPosition.Y * mapInfo.TileHeight - (npc.Sprite.FrameDimension.Y - mapInfo.TileHeight));
                npc.ID = i;
                npc.Ready += ReadyHandler;
                npc.Timer = cActorMoveTime + rand.Next(2000);
                mapActors.Add(npc);
            }

            // DEBUG:  Adds the NPCs to the map
            for (int i = 0; i < mapInfo.BottomGrid.Count; i++)
                mapNPC.Add(3);
        }