Inheritance: GameBehavior
Esempio n. 1
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     lunaCharacterController = GetComponent<LunaCharacterController>();
     playerScript = GetComponent<PlayerScript>();
     pStats = GetComponent<AbilityBar> ();
     fireballSpawn = GameObject.FindGameObjectWithTag("FireballSpawn");
 }
Esempio n. 2
0
    private void CreateAbilityBar()
    {
        Vector2 screenResolution = new Vector2(Screen.width, Screen.height);

        abilityBar = Instantiate(abilityBarPrefab);

        abilityBar.transform.SetParent(FindObjectOfType <Canvas>().transform);
        abilityBar.transform.position += new Vector3(screenResolution.x, screenResolution.y, 0);
        abilityBar.setAbilityCooldown(1 - _cooldownValue / Cooldown);
        //abilityBar.transform.Find("Bullet").GetComponent<Image>().color = bulletBarColor;
    }
Esempio n. 3
0
    // Use this for initialization
    IEnumerator Start()
    {
        playerUnitPanels = new List <PlayerUnitPanel>();

        canvas             = GetComponentInChildren <Canvas>();
        player             = transform.root.GetComponent <Player>();
        targetManager      = player.GetComponentInChildren <TargetManager>();
        formationManager   = player.GetComponentInChildren <FormationManager>();
        dialogManager      = player.GetComponentInChildren <DialogManager>();
        playerUnitBar      = GetComponentInChildren <PlayerUnitBar>();
        enemyUnitBar       = GetComponentInChildren <EnemyUnitBar>();
        selectionIndicator = GetComponentInChildren <SelectionIndicator>();
        abilityBar         = GetComponentInChildren <AbilityBar>();
//        upperBar = GetComponentInChildren<UpperBar>();
        generalIndicatorBar = GetComponentInChildren <GeneralIndicatorBar>();
        enemyCountBar       = GetComponentInChildren <EnemyCountBar>();
        unitPanelWrapper    = GetComponentInChildren <UnitPanelWrapper>();

        animator = GetComponent <Animator>();

        if (player && player.human)
        {
            while (!animator || !player || !targetManager || !formationManager)
            {
                yield return(new WaitForSeconds(0.1f));
            }
        }

        ResourceManager.StoreSelectBoxItems(selectBoxSkin, healthy, damaged, critical);

        SetCursorState(CursorState.Select);

        buildAreaHeight = Screen.height - RESOURCE_BAR_HEIGHT - SELECTION_NAME_HEIGHT - 2 * BUTTON_SPACING;

        List <AudioClip> sounds  = new List <AudioClip>();
        List <float>     volumes = new List <float>();

        sounds.Add(clickSound);
        volumes.Add(clickVolume);
        audioElement = new AudioElement(sounds, volumes, "HUD", null);

        Cursor.lockState   = CursorLockMode.Locked;
        cursorPosition     = new Vector3(Screen.width / 2, Screen.height / 2);
        lastCursorPosition = new Vector3(Screen.width / 2, Screen.height / 2);
    }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        characters = FindObjectsOfType <SelectableCharacter>();

        foreach (SelectableCharacter character in characters)
        {
            character.onClicked.AddListener((eventData) => { OnCharacterWasClicked(character); });

            character.onPointerEnter.AddListener((eventData) => { OnCharacterPointed(character); });

            character.onPointerExit.AddListener((eventData) => { OnCharacterPointerExited(character); });
        }

        if (abilityBar == null)
        {
            abilityBar = GetComponentInChildren <AbilityBar>();
        }
    }
Esempio n. 5
0
    private void DrawAbilityBar(AbilityBar abilityBar, Unit unit)
    {
        if (!unit || !unit.GetAbilityAgent())
        {
            return;
        }

        var abilitySlots = abilityBar.AbilitySlots;
        var selection    = player.SelectedObject;

        // var selectedUnit = (Unit)selection;
        var abilities      = unit.GetAbilityAgent().abilities;
        var multiAbilities = unit.GetAbilityAgent().abilitiesMulti;

        abilityBar.DrawAbilities(
            abilities,
            multiAbilities,
            targetManager.InMultiMode,
            targetManager.InMultiMode
                ? player.selectedAlliesTargettingAbility
                : player.selectedAllyTargettingAbility
            );
    }
Esempio n. 6
0
 void Start()
 {
     instance       = this;
     contentRectPos = contentRect.position;
     AddAbilityTest();
 }
Esempio n. 7
0
 public void AddAbility(Research research)
 {
     AbilityBar.AddAbility(int.Parse(research.meta));
 }
Esempio n. 8
0
 // Use this for initialization
 void Start()
 {
     inspector = GetComponentInChildren <UnitInspector>();
     inspector.gameObject.SetActive(false);
     abilityBar = GetComponentInChildren <AbilityBar>();
 }
Esempio n. 9
0
 private void Awake()
 {
     singleton = this;
 }
Esempio n. 10
0
 // Use this for initialization
 public void Start()
 {
     abilityBar    = GetComponentInChildren <AbilityBar>();
     unitIndicator = GetComponentInChildren <Indicator>();
 }