コード例 #1
0
ファイル: MainStage.cs プロジェクト: hx83/Hex_Project
    public void Start()
    {
        Vector3 v  = new Vector3(1, 0, 0);
        Vector3 v2 = Quaternion.AngleAxis(45, new Vector3(0, 0, 1)) * v;

        if (isStart == false)
        {
            Hero           = PlayerManager.CreateHero();
            Hero.BornPoint = MapManager.GetRandomBornPoint();
            Hero.AddEventListener(PlayerEvent.DIE, OnHeroDie);
            Hero.AddEventListener(PlayerEvent.RELIFE, OnHeroRelife);

            MapManager.AddPlayer(Hero);
            CameraManager.Follow(Hero.transform);

            battleUI = new BattleUI();
            battleUI.AddEventListener(BaseEvent.COMPLETE, OnBattleUIComplete);
            battleUI.Init();

            isStart = true;
        }
        else
        {
            Hero.Relife();
        }
    }
コード例 #2
0
ファイル: PlayerManager.cs プロジェクト: hx83/Hex_Project
    public static HeroPlayer CreateHero()
    {
        playerCount++;
        HeroPlayer p = new HeroPlayer();

        p.ID = playerCount;
        AddPlayer(p);
        return(p);
    }
コード例 #3
0
 void Awake()
 {
     if (S == null)
     {
         S = this;  //set the singleton
     }
     else
     {
         Debug.LogError("HeroPlayer.Awake() - Attempted to assign second HeroPlayer.S!");
     }
 }
コード例 #4
0
        static void Main(string[] args)
        {
            Player player      = new SimplePlayer();
            int    stepCounter = 0;

            while (true)
            {
                Console.WriteLine(player);

                ConsoleKey key = Console.ReadKey().Key;

                switch (key)
                {
                case ConsoleKey.UpArrow:
                    player.MoveUp();
                    break;

                case ConsoleKey.DownArrow:
                    player.MoveDown();
                    break;

                case ConsoleKey.LeftArrow:
                    player.MoveLeft();
                    break;

                case ConsoleKey.RightArrow:
                    player.MoveRight();
                    break;

                case ConsoleKey.Q:
                    player.AddHealth();
                    break;
                }
                stepCounter++;


                if (stepCounter == 10)
                {
                    player = HeroPlayer.CreateInstance(player);
                }
            }
        }