Пример #1
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     brain = animator.GetComponent <BrainManager>();
     brain.outline.enabled = true;
     abilityCanvas         = brain.manager.hotbar;
     abilitySelector       = abilityCanvas.GetComponent <AbilitySelector>();
 }
        // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
        override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            brain = animator.GetComponent <BrainManager>();
            brain.indicatorRend.enabled = true;

            creature = animator.GetComponent <UniqueCreature>();
            brain.outline.enabled = true;
            ms = animator.GetComponent <MovementSystem>();
            ms.finishedMoving = true;

            List <Ability> abilityList = brain.GetComponent <UnitAbilitiesContainer>().abilities;

            abilityCanvas                  = brain.manager.hotbar;
            abilitySelector                = abilityCanvas.GetComponent <AbilitySelector>();
            abilitySelector.abilityList    = abilityList;
            abilitySelector.setAbilityList = true;
            abilitySelector.SelectedAbilityButton(-1);
            abilityButtons = abilitySelector.AbilityButtons;
            for (int i = 0; i < abilityButtons.Length; i++)
            {
                if (i < abilityList.Count)
                {
                    abilityButtons[i].GetComponent <Button>().interactable = true;
                    abilityButtons[i].GetComponent <AbilityButtonHighlight>().isEnabled = true;
                    abilityButtons[i].GetComponent <AbilityButtonHighlight>().ability   = abilityList[i];
                }
                else
                {
                    abilityButtons[i].GetComponent <Button>().interactable = false;
                    abilityButtons[i].GetComponent <AbilityButtonHighlight>().isEnabled = false;
                }
            }
            possible = ms.GetPossible(creature.movementLeft);
        }
Пример #3
0
        public Rocket(GameObject missileObject, uint nrOfMissiles, float speed, float turningSpeed,
                      float maxDist, Position position, AntiPosition antiPosition, Camera camera,
                      AbilitySelector selector, float timeout, float explosionForce)
        {
            // Create containers
            this.missilePool = new Queue <GameObject>();
            this.activePool  = new HashSet <GameObject>();

            // Internal state
            this.camera   = camera;
            this.selector = selector;

            // Fill the item pool
            for (uint i = 0; i < nrOfMissiles; ++i)
            {
                GameObject rocket = Instantiate(missileObject, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);
                rocket.SetActive(false);

                Missile missile = rocket.GetComponent <Missile>();
                missile.speed          = speed;
                missile.turningSpeed   = turningSpeed;
                missile.onDestroy      = this.Destroy;
                missile.maxDistance    = maxDist;
                missile.position       = position;
                missile.timeout        = timeout;
                missile.explosionForce = explosionForce;

                TrailShifter ts = rocket.GetComponentInChildren <TrailShifter>();
                ts.SetSimulationSpace(antiPosition);

                missilePool.Enqueue(rocket);
            }
        }
Пример #4
0
 void Awake()
 {
     map         = GetComponentInParent <TileArrangement> ();
     chosenTiles = new Stack <TileAttributes> ();
     possibleMoveHighlighters = new List <GameObject> ();
     abilitySelectorObject    = savedAbilitySelectorObject;
     abilitySelector          = abilitySelectorObject.GetComponent <AbilitySelector> ();
 }
Пример #5
0
    void ActivateAbility(Side side)
    {
        Ability ability = sideAbility[side];

        if (ability != null)
        {
            ability.Activate();

            // UI
            this.currentSelector = ability.GetSelector();
            this.currentSelector.Select();
        }

        this.activeSide = side;
    }
Пример #6
0
	/* Static Methods */
	public static AbilitySelector Create(Transform parent, string abilityName, int abilityIndex, ToggleGroup tg)
	{
		GameObject pref = ABU.LoadAsset<GameObject> (PREF_DIR, "AbilityToggle");
		GameObject inst = Instantiate<GameObject> (pref, parent, false);
		AbilitySelector aSel = inst.GetComponent<AbilitySelector> ();
		aSel.abilityName = abilityName;
		aSel.abilityIndex = abilityIndex;
		aSel.SetAbility ();

		aSel.activeSet = true;

		Toggle t = inst.GetComponent<Toggle> ();
		t.group = tg;

		return aSel;
	}
Пример #7
0
        public SpaceCamera(Objective objective, AbilitySelector selector, ObjectiveArrow objectiveArrow, Image objectiveCircle,
                           Camera camera, CameraFlash cameraFlash, SceneChanger sceneChanger, Text level)
        {
            this.objective       = objective;
            this.selector        = selector;
            this.objectiveArrow  = objectiveArrow;
            this.objectiveCircle = objectiveCircle;
            this.camera          = camera;
            this.cameraFlash     = cameraFlash;
            this.sceneChanger    = sceneChanger;
            this.level           = level;

            // By default, off
            this.objectiveCircle.gameObject.SetActive(false);
            this.objectiveArrow.gameObject.SetActive(false);
        }
Пример #8
0
    private void SetupWheel(int abilityIndex, Transform layout, string[] abilityList)
    {
        ToggleGroup tg = layout.GetComponent <ToggleGroup> ();

        for (int i = 0; i < abilityList.Length; i++)
        {
            if (/*true ||*/ GameManager.instance.isAbilityUnlocked(abilityList [i]))
            {
                Ability         a    = HUDManager.GetInstance().GetSubject().GetAbility(abilityIndex);
                AbilitySelector aSel = AbilitySelector.Create(layout, abilityList [i], abilityIndex, tg);
                if (a != null && a.name == abilityList [i])
                {
                    aSel.SetActive(false);
                    aSel.SetToggle(true);
                    aSel.SetActive(true);
                }
            }
        }
    }
Пример #9
0
    void executeSelectionModeActions()
    {
        switch (mode)
        {
        case SelectionMode.PIECE_TO_USE:
            //For selecting tiles with charachters on them.
            if (selectedTile.containedCharacter != null && currentTeam.Contains(selectedTile.containedCharacter))
            {
                //expand over piece.
                gameObject.transform.localScale = new Vector3(1f, 1f, 1f);
                //gameObject.transform.localScale = new Vector3 (1.459983f,1.459983f,1f);

                //Use Enter key to highlight possible moves
                if ((Input.GetKeyUp(KeyCode.Return) || Input.GetMouseButtonUp(0)) && selectedTile.containedCharacter.usedAbility == false)
                {
                    chosenCharacter       = selectedTile.containedCharacter;
                    abilitySelectorObject = GameObject.Instantiate(savedAbilitySelectorObject, (new Vector3(0f, 0f, 0f)) /*GameObject.Find("Ability Instruction Panel").transform.position*/ /*new Vector3(0,0,0)*/ /*new Vector3(308, 0, -101)*/, new Quaternion(), map.ui.transform);
                    abilitySelector       = abilitySelectorObject.GetComponent <AbilitySelector> ();


                    //Instantiate(Resources.Load("Panels/Ability Select Panel"));
                    mode = SelectionMode.HIGHLIGHT_POSSIBLE_MOVES;
                }
            }

            /*else
             *          {
             *
             *                  gameObject.transform.localScale = new Vector3 (1f,1f,1f);
             *          }*/
            break;

        case SelectionMode.HIGHLIGHT_POSSIBLE_MOVES:         //an init state for MOVE_TO_TILE
            foreach (GameObject g in possibleMoveHighlighters)
            {
                GameObject.Destroy(g);
            }
            chosenCharacter.HighlightMoves();
            mode = SelectionMode.MOVE_TO_TILE;
            break;

        case SelectionMode.MOVE_TO_TILE:
            if (Input.GetKeyUp(KeyCode.Return) || Input.GetMouseButtonUp(0))
            {
                if (selectedTile.GetComponentInChildren <RectTransform>() != null)
                {
                    chosenCharacter.type.movement.Move(selectedTile);
                }
                foreach (GameObject g in possibleMoveHighlighters)
                {
                    GameObject.Destroy(g);
                }
                Destroy(abilitySelectorObject);
                mode = SelectionMode.PIECE_TO_USE;
            }
            break;

        case SelectionMode.USE_ABILITY:
            abilityInUse.Use();
            foreach (GameObject g in possibleMoveHighlighters)
            {
                GameObject.Destroy(g);
            }
            break;

        case SelectionMode.SELECT_TARGETS:
            abilityInUse.Use();
            if (Input.GetKeyUp(KeyCode.Return) || Input.GetMouseButtonUp(0))
            {
                ((CharachterTargeter)abilityInUse).targets.Add(selectedTile);
            }
            break;

        case SelectionMode.SELECT_TILES:
            abilityInUse.Use();
            if (Input.GetKeyUp(KeyCode.Return) || Input.GetMouseButtonUp(0))
            {
                ((TileTargeter)abilityInUse).targets.Add(selectedTile);
            }
            break;
        }
    }
Пример #10
0
 public Shield(GameObject shieldObject, AbilitySelector selector)
 {
     this.shield = Instantiate(shieldObject, new Vector3(0.0f, 0.0f, 0.0f), Quaternion.identity);
     this.shield.SetActive(false);
     this.selector = selector;
 }