예제 #1
0
    public void Start()
    {
        _fightMenuDetail = FindObjectOfType<FightMenuDetail>();
        _fightWorkflow = FindObjectOfType<FightWorkflow>();
        _spawnStart = GameObject.Find("EnemySpawnStart").gameObject;

        _fightMenu = FindObjectOfType<FightMenu>();

        _player = GameObject.Find("BirdSprite");

        var prefab = Resources.Load<GameObject>("Prefabs/Battle/SelectionArrow");
        _selectionArrow = Instantiate(prefab);
        _selectionArrow.name = "Enemy-Select-Arrow";

        Enemies = new List<GameObject>();

        var crabEnemy = new EnemyType
        {
            Id = "Crab",
            Name = "Crab",
            Defense = 0,
            Health = 2,
            PrefabPath = "Prefabs/Battle/CrabPinch"
        };

        var birdEnemy = new EnemyType
        {
            Id = "RedBird",
            Name = "RedBird",
            Defense = 0,
            Health = 2,
            PrefabPath = "Prefabs/Battle/RedBird"
        };

        var enemiesToSpawn = new List<EnemyType>();
        enemiesToSpawn.Add(crabEnemy);
        enemiesToSpawn.Add(crabEnemy);
        enemiesToSpawn.Add(birdEnemy);

        InitEnemies(_spawnStart.transform.position, enemiesToSpawn);

        DisableEnemySelect();
    }
예제 #2
0
    // Current item
    // 

    void Start()
    {
        var menuItemKinds = FightMenuItem.GetAllKinds();

        var initialPosition = transform.position;
        var initialRadians = 0;
        var radianIncrement = Mathf.PI / 6;
        var radius = 2.5f;


        FightMenuItemPrefab = Resources.Load<GameObject>("Prefabs/Battle/MenuItem-Default");

        for (int i = 0; i < menuItemKinds.Count; i++)
        {
            var res = Instantiate(FightMenuItemPrefab);
            var menuItem = res.GetComponent<FightMenuItem>();
            menuItem.SetKind(menuItemKinds[i]);
            menuItem.transform.parent = transform;
            MenuItems.Add(menuItem);

            var x = radius*Mathf.Cos(initialRadians + (radianIncrement*i));
            var y = radius*Mathf.Sin(initialRadians + (radianIncrement*i));

            menuItem.transform.position = transform.position + new Vector3(x, y, 0f);   
        }

        ScrubMenuItems = new ScrubList<FightMenuItem>(MenuItems);

        SetCurrentMenuItem(ScrubMenuItems.Current());

        FightMenuDetail = FindObjectOfType<FightMenuDetail>();
    }