public Outcome Activate(Character guy) { if (activatedCharacter != null) { Deactivate(activatedCharacter); //TODO: add to outcome } var outcome = new Outcome(); outcome.ActionTaken = "Activate"; outcome.UserID = guy.ID; if (guy.HasBeenActivated) { outcome.Message.AppendLine(guy.Name + " has already been activated this turn"); return(outcome); } if (guy.SideID != currentSide.ID) { outcome.Message.AppendLine(guy.Name + " does not belong to current side, " + currentSide.Name); return(outcome); } guy.Activate(); var tile = map.GetTile(guy.Pos); tile.CharacterActivated(this, guy); activatedCharacterID = guy.ID; outcome.Message.AppendLine("Starting activation for " + guy.Name); return(outcome); }
public void CreateAvatar() { inventory = gameObject.GetComponent <Inventory>(); GameObject go = Instantiate(avatarPrefab, new Vector3(0, 0, 0), Quaternion.identity); character = go.GetComponent <Character>(); character.Activate(this); isCreated = true; inventory.SetUp(); cameraContainer.GetComponent <CameraScript>().ToggleCamera(character.gameObject); keybinder.ImportBinding(); }
public void NextCharacter() { Character tmp; tmp = order[0]; order.RemoveAt(0); order.Add(tmp); if (!order[0].gameObject.activeSelf) { NextCharacter(); } character = order[0]; character.Activate(2); }
private void ActivateCharacter(Character newCharacter) { if (newCharacter == _activeCharacter || newCharacter == null) { return; } if (_activeCharacter != null) { _activeCharacter.Deactivate(); } _activeCharacter = newCharacter; ActiveCharacterTransform = _activeCharacter.transform; newCharacter.Activate(); }
void Update() { input += new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); if (Input.GetKey(KeyCode.Mouse0)) { mousePos = Input.mousePosition; activated = true; } if (Input.GetKeyDown(KeyCode.E)) { pickupItem = true; } timer += Time.deltaTime; if (timer > 1 / tps) { timer -= 1 / tps; if (input != Vector2.zero) { Vector2 normInput = input.normalized * 2; e.MoveInLine(new Position((int)normInput.x, (int)normInput.y), (int)(e.GetStat(EntityLiving.Stat.MOVEMENT_SPEED) * ((normInput.x != 0 && normInput.y != 0) ? 1.5f : 1)), world, true); } input = Vector2.zero; if (activated) { e.Activate(world, worldRenerer.FromVector2ToPlayerPosition(Camera.main.ScreenToWorldPoint(mousePos), world)); activated = false; } if (pickupItem) { e.OpenItemCompareOverlay(world); pickupItem = false; } world.Tick(); } }
public void StartGame() { UI_Manager.UIManager.UI_Close("UI_Battle_Spawn"); UI_Manager.UIManager.UI_Close("UI_Battle_Start"); UI_Battle_Notification.notification.Clear(); bSpawning = false; bVictory = false; bInFight = true; SortUnitByInitiative(); if (!order[0].gameObject.activeSelf) { NextCharacter(); } else { character = order[0]; } if (bInFight) { character.Activate(2); } }
public void Activate() { _char.Activate(); }