// GET: Character/Details/5 public async Task <ActionResult> Details(int ChaID) { int y = ChaID; var request = CreateRequestToService(HttpMethod.Get, "api/Characters/Details", y); // go to API try { var response = await HttpClient.SendAsync(request); if (!response.IsSuccessStatusCode) { return(View("unauthorized")); } string jsonString = await response.Content.ReadAsStringAsync(); Character2 characterCampaigns = JsonConvert.DeserializeObject <Character2>(jsonString); return(View(characterCampaigns)); } catch (HttpRequestException ex) { // logging return(View("Error")); } }
public void Interact(Node caller) { if (Mode == ModeEnum.Rigid) { Mode = ModeEnum.Kinematic; var currentTransform = GlobalTransform; GetParent().RemoveChild(this); var attachPoint = ((Character2)caller).GetAttachPoint(); if (attachPoint != null) { attachPoint.AddChild(this); } else { caller.AddChild(this); } GlobalTransform = currentTransform; } else { Mode = ModeEnum.Rigid; var currentTransform = GlobalTransform; GetParent().RemoveChild(this); OriginalParent.AddChild(this); GlobalTransform = currentTransform; Character2 thrower = caller as Character2; ApplyCentralImpulse(-thrower.GlobalTransform.basis.z * ThrowStrength); } }
public void StartBattle(Character2 character2, Characters wildEnemy) { this.character2 = character2; this.wildEnemy = wildEnemy; StartCoroutine(SetUpBattle()); }
// Use this for initialization void Start() { character = GameObject.FindGameObjectWithTag("Player").GetComponent<Character>(); character2 = GameObject.FindGameObjectWithTag("Player2").GetComponent<Character2>(); ObjectDictionary = new Dictionary<string, Transform>(); EnemyDictionary = new Dictionary<string, Transform>(); Transform[] spawnPoints = Transform.FindObjectsOfType(typeof(Transform)) as Transform[]; foreach (Transform point in spawnPoints) { if (point.tag == "ObjectSpawn") ObjectDictionary.Add(point.name, point); if (point.tag == "EnemySpawn") EnemyDictionary.Add(point.name, point); } foreach (Transform _point in ObjectDictionary.Values) { Instantiate(SpawnObjects[Random.Range(0, SpawnObjects.Count)], _point.position, _point.rotation); } foreach (Transform _point in EnemyDictionary.Values) { Instantiate(SpawnEnemy[Random.Range(0, SpawnEnemy.Count)], _point.position, _point.rotation); } }
public Character2 GetCharactertByID(int id) // get all character of user { var x = _db.Character.FirstOrDefault(y => y.Id == id); if (x == null) { return(null); } else { Character2 thecharacter = new Character2 { UserId = x.UserId, Id = x.Id, Name = x.Name, Alignment = x.Alignment, ArmorClass = x.ArmorClass, Background = x.Background, CampaignId = x.CampaignId, Charisma = x.Charisma, Constitution = x.Constitution, CreationDate = x.CreationDate, Dexterity = x.Dexterity, Experience = x.Experience, HitPoints = x.HitPoints, Intelligence = x.Intelligence, Race = x.Race, Strength = x.Strength, Wisdom = x.Wisdom }; return(thecharacter); } }
// GET: CharacterCampaign/Details/5 public async Task <ActionResult> Details(int id) { var request = CreateRequestToService(HttpMethod.Get, $"api/characters/Details/{id}"); try { var response = await HttpClient.SendAsync(request); if (!response.IsSuccessStatusCode) { return(View("unauthorized")); } string jsonString = await response.Content.ReadAsStringAsync(); Character2 character = JsonConvert.DeserializeObject <Character2>(jsonString); return(View(character)); } catch (HttpRequestException ex) { // logging return(View("Error")); } //return RedirectToAction("Details", "character", id); }
// Start is called before the first frame update void Start() { Character Player1 = Character1.GetComponent <Character>(); Character Player2 = Character2.GetComponent <Character>(); Character Player3 = Character3.GetComponent <Character>(); Character Player4 = Character4.GetComponent <Character>(); Enemy Enemy1 = EnemyBattler.GetComponent <Enemy>(); //Jag vet inget mer effektivt sätt att samla allt i en Public lista än det här CharacterList.Add(Player1); CharacterList.Add(Player2); CharacterList.Add(Player3); CharacterList.Add(Player4); EnemyList.Add(Enemy1); PositionList.Add(Character1); PositionList.Add(Character2); PositionList.Add(Character3); PositionList.Add(Character4); attackButton.onClick.AddListener(Attack); skillButton.onClick.AddListener(Skills); personaButton.onClick.AddListener(Personas); guardButton.onClick.AddListener(Guard); cancel.onClick.AddListener(Cancel); dataHandler = dataHandlerOBJ.GetComponent <Ownership>(); }
void Start() { GameObject tempObj = GameObject.Find("Character"); scriptInstance = tempObj.GetComponent <Character2>(); GameObject tempObj2 = GameObject.Find("Sphere"); scriptCantouch = tempObj2.GetComponent <NewBehaviourScript2>(); }
public void StartNPCBattle(Character2 character2, Character2 npc) { this.character2 = character2; this.npc = npc; isNPCbattle = true; player = character2.GetComponent <PlayerMovement>(); boss = npc.GetComponent <BossController>(); StartCoroutine(SetUpBattle()); }
// Start is called before the first frame update void Start() { AudioListener.volume = PlayerPrefs.GetFloat("volume", 1.0f); GameObject tempObj = GameObject.Find("Sphere"); scriptInstance6 = tempObj.GetComponent <NewBehaviourScript2>(); GameObject tempObj2 = GameObject.Find("Character"); scriptInstance5 = tempObj2.GetComponent <Character2>(); MusicSource4.clip = clip4; }
void Start() { AudioListener.volume = PlayerPrefs.GetFloat("volume", 1.0f); CanvasObject.GetComponent <Canvas>().enabled = false; GameObject tempObj = GameObject.Find("Character"); scriptInstance8 = tempObj.GetComponent <Character2>(); GameObject tempObj2 = GameObject.Find("Timer"); scriptInstance7 = tempObj2.GetComponent <TimerHard>(); MusicSource3.clip = clip3; }
public void Start() { int v = 0; Character1 = InitPlayer(0, true); Character2 = InitPlayer(1, false); World = InitWorld(); while (Character1.Alive && !World.HasWinner()) { try { Turn++; World.Show(Character1, Character2, Turn, true); Character1.Moving(); Console.WriteLine("Tap <Enter> to finish move..."); Console.ReadLine(); World.Show(Character1, Character2, Turn, false); Character2.Moving(); Console.WriteLine("Tap <Enter> to finish move..."); Console.ReadLine(); World.Show(Character1, Character2, Turn); foreach (Bot item in GameObjects.Where(x => x is Bot b && b.Alive)) { item.Move(""); } Console.ReadKey(); if (Turn == 2) { var a = 5 / v; throw new GameException("Buy this game to continue"); } } catch (GameException ex) { Console.WriteLine(ex.Message); } catch (DivideByZeroException ex) { Console.WriteLine(ex.Message); } finally { Console.ReadLine(); Console.WriteLine("End turn."); } } World.Show(Character1, Character2, Turn); Console.WriteLine($"Congrats {World.GetWinner().Name}!"); }
public void SetCharactersInit(GameObject C1, GameObject C2) { Character1 = (GameObject)Instantiate(C1, CharacterPos1.position, Quaternion.identity); Character2 = (GameObject)Instantiate(C2, CharacterPos2.position, Quaternion.identity); Character1.transform.SetParent(CharacterPos1); Character2.transform.SetParent(CharacterPos2); CharacterBase1 = Character1.GetComponent <CharacterBase>(); CharacterBase2 = Character2.GetComponent <CharacterBase>(); CharacterPos1.GetComponent <TriggerRange>().m_CharacterBase = CharacterBase1; CharacterPos2.GetComponent <TriggerRange>().m_CharacterBase = CharacterBase2; }
private void Awake() { ch2 = this; }
// Use this for initialization void Start() { savedTime = Time.timeScale; Time.timeScale = 0; character = GameObject.FindGameObjectWithTag("Player2").GetComponent<Character2>(); }
// Use this for initialization void Start() { anim = GetComponent<Animator>(); health = 2; target = GameObject.FindGameObjectWithTag("Player").GetComponent<Character2>(); if (!target) { Debug.Log("player 1 not found"); } target2 = GameObject.FindGameObjectWithTag("Player2").GetComponent<Character2>(); if (!target2) { Debug.Log("player 2 not found"); } }
public Character2 Details(int id) // works if hardcode id = 1 { Character2 thecharacter = Repo.GetCharactertByID(id); return(thecharacter); }
private void Update() { //if moveontonextround=true then i=0 GameObject tempObj = GameObject.Find("Character"); script2Instance = tempObj.GetComponent <Character2>(); if (script2Instance.MoveOnToNextRound == true) { i = 0.0f; x = 0; m = 0; hasArrived = false; canMove = false; secondround = true; timer = 0f; moves123 += 0.2f; PlayerPrefs.SetFloat("moves123", moves123); movementDuration -= 0.05f; Debug.Log(movementDuration); if (movementDuration <= 0.9f) { movementDuration = 0.9f; } PlayerPrefs.SetFloat("movementDuration", movementDuration); VenomSpell.Stop(); endParticle = true; if (moves123 < 0) { randomO = 1; vertical = true; Debug.Log(randomO); } if (moves123 >= 1) { randomO = Random.Range(0, 2); Debug.Log(randomO); GameObject PlaneObj = GameObject.Find("Plane"); if (randomO == 1) //vertical { if (vertical == false) { PlaneObj.transform.Rotate(0, 90, 0, Space.World); vertical = true; } else { PlaneObj.transform.Rotate(0, 0, 0, Space.World); vertical = true; } } if (randomO == 0) //horizontal { if (vertical == false) { PlaneObj.transform.Rotate(0, 0, 0, Space.World); vertical = false; } else { PlaneObj.transform.Rotate(0, 90, 0, Space.World); vertical = false; } } } script2Instance.MoveOnToNextRound = false; } if (!hasArrived && i == 0.0f) //1st round 1st move, not origin, 2nd round 2nd move, not same { gameObject.GetComponent <Renderer>().enabled = true; //gameObject.GetComponent<Renderer>().material.color = new Color(147, 176, 145, 255); // make ball original colour hasArrived = true; { float randX = Random.Range(0, 3); float randZ = Random.Range(0, 3); if (secondround == false && randX == 0 && randZ == 0) { randX = Random.Range(1, 3); randZ = Random.Range(0, 3); } if (secondround == true) { while (EscapeLoop == 0) { arrayList2x.Add(randX); arrayList2z.Add(randZ); if (arrayList2x[0].Equals(arrayListx[arrayListx.Count - 1]) && (arrayList2z[0].Equals(arrayListz[arrayListz.Count - 1]))) //change depending on moves { arrayList2x.RemoveAt(arrayList2x.Count - 1); //??? arrayList2z.RemoveAt(arrayList2z.Count - 1); //??? randX = Random.Range(1, 3); randZ = Random.Range(0, 3); //arrayList2x.Clear(); //arrayList2z.Clear(); EscapeLoop = 0; } else { EscapeLoop = 1; } } } arrayList2x.Clear(); arrayList2z.Clear(); arrayListx.Clear(); arrayListz.Clear(); arrayListx.Add(randX); arrayListz.Add(randZ); //change move to teleport //StartCoroutine(MoveToPoint(new Vector3(randX, 0, randZ))); VenomSpell.Play(); ParticleSystem.Play(); StartCoroutine(Wait()); transform.position = new Vector3(randX, 0, randZ); if (randomO == 0) { Vector3 newPosition; newPosition = gameObject.transform.position; newPosition[2] = 3 - newPosition[2]; //convert to negative coordinates arrayList.Add(newPosition); } if (randomO == 1) { Vector3 newPosition; newPosition = gameObject.transform.position; newPosition[0] = 3 - newPosition[0]; //convert to negative coordinates arrayList.Add(newPosition); } } } if (!hasArrived && i >= 1.0f && i < Mathf.Floor(moves123)) //2nd move onwards,no repeat { hasArrived = true; { float randX = Random.Range(0, 3); float randZ = Random.Range(0, 3); arrayListx.Add(randX); arrayListz.Add(randZ); //Debug.Log(arrayListx[x]); //Debug.Log(arrayListx[x + 1]); //Debug.Log(arrayListz[x]); //Debug.Log(arrayListz[x + 1]); while (EscapeLoop == 0) { if (arrayListx[x].Equals(arrayListx[x + 1]) && (arrayListz[x].Equals(arrayListz[x + 1]))) { //HAVE TO REMOVE THE ADDED X AND Z //generate a new random arrayListx.RemoveAt(arrayListx.Count - 1); arrayListz.RemoveAt(arrayListz.Count - 1); randX = Random.Range(1, 3); randZ = Random.Range(0, 3); arrayListx.Add(randX); arrayListz.Add(randZ); EscapeLoop = 0; } else { x += 1; EscapeLoop = 1; } } StartCoroutine(MoveToPoint(new Vector3(randX, 0, randZ))); } } if (!hasArrived && i == Mathf.Floor(moves123)) //change depending on number of moves { //have to change previous if i value also script2Instance.touchytouchy = true; timer += Time.deltaTime; if (timer < timerMax && endParticle == true) { gameObject.GetComponent <Renderer>().enabled = false; endParticle = false; } if (timer >= timerMax) { canMove = true; //gameObject.GetComponent<Renderer>().material.color = new Color(147, 176, 145, 0); //make ball transparent hasArrived = true; } } }
// Use this for initialization void Start() { anim = gameObject.GetComponent<Animation>(); health = 5; target = GameObject.FindGameObjectWithTag("Player").GetComponent<Character2>(); target2 = GameObject.FindGameObjectWithTag("Player").GetComponent<Character2>(); dead = false; }