Exemplo n.º 1
0
    // Use this for initialization
    new private void Start()
    {
        base.Start();

        CDebugLog.Log(ELogType.GameMode, "TestGameMode Start");

        GameObject PlayerStart    = GameObject.FindGameObjectWithTag("PlayerStart");
        Vector3    PlayerPosition = PlayerStart.transform.position;

        PlayerPosition.z = 0.0f;
        GameObject PlayerObj = Instantiate <GameObject>(CResourceMgr.LoadCharacter(player_name, ECharacterType.Player), PlayerPosition, new Quaternion());

        Player = PlayerObj.GetComponent <CBaseCharacter>();
        Vector3 position = Camera.main.transform.position;

        position.x = PlayerPosition.x;
        position.y = PlayerPosition.y;
        Camera.main.transform.position = position;

        InitUIKeyEvent();

        GameObject FindObj = GameObject.Find("TouchInput");

        DefaultTouchInputPos = FindObj.transform.position;
    }
Exemplo n.º 2
0
    // Use this for initialization
    new private void Start()
    {
        base.Start();

        CDebugLog.Log(ELogType.GameMode, "BattleGameMode Start");

        GameObject PlayerStart    = GameObject.FindGameObjectWithTag("PlayerStart");
        Vector3    PlayerPosition = PlayerStart.transform.position;

        PlayerPosition.z = 0.0f;
        GameObject PlayerObj = Instantiate <GameObject>(CResourceMgr.LoadCharacter(PlayerName, ECharacterType.Player), PlayerPosition, new Quaternion());

        Player = PlayerObj.GetComponent <CBaseCharacter>();
        Vector3 position = Camera.main.transform.position;

        position.x = PlayerPosition.x;
        position.y = PlayerPosition.y;
        Camera.main.transform.position = position;

        //GameObject Canvas = GameObject.FindGameObjectWithTag("Canvas");
        //GameObject BattleWidget = UIMgr.OpenUI(EUIType.BattleWidget);
        //GameObject InsBattleWidget = Instantiate(BattleWidget);
        //InsBattleWidget.transform.parent = Canvas.transform;
        //Debug.Log(BattleWidget);

        InitUIKeyEvent();

        GameObject FindObj = GameObject.Find("TouchInput");

        DefaultTouchInputPos = FindObj.transform.position;
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (CMapGenerator.bTool)
        {
            return;
        }

        if (!bSpawnStart)
        {
            return;
        }

        if (CurSpawnCount == 0)
        {
            if (false == bLoopSpawn)
            {
                bSpawnStart = false;
            }
            else if (bLoopSpawn && 0 == SpawnedObjects.Count)
            {
                RemainTime    = SpawnTime;
                CurSpawnCount = MaxSpawnCount;
            }
            return;
        }

        if (RemainTime <= 0)
        {
            GameObject spawnObj = Instantiate(CResourceMgr.LoadCharacter(GetLoadCharacterName(), ECharacterType.Enemy) /*, gameObject.transform*/);
            spawnObj.transform.position = gameObject.transform.position;
            SpawnedObjects.Add(spawnObj);
            RemainTime = SpawnTime;
            --CurSpawnCount;
        }
        else
        {
            RemainTime -= Time.fixedDeltaTime;
        }
    }