public override void Start(RAIN.Core.AI ai) { base.Start(ai); ig = ai.Body.GetComponentInChildren <IntakeGenerator>(); anim = ai.Body.GetComponent <Animator>(); if (actionName == "GolemAttack") { ai.WorkingMemory.SetItem("attacking", true); ai.WorkingMemory.SetItem("walking", false); ig.active = true; walkAnim = false; attacking1 = true; } else if (actionName == "GolemWalk") { ai.WorkingMemory.SetItem("attacking", false); ai.WorkingMemory.SetItem("walking", true); walkAnim = true; attacking1 = false; ig.active = false; } anim.SetBool("walking", walkAnim); anim.SetBool("attacking", attacking1); //custom = ai.GetCustomElement(" "); }
private Transform GenerateBladeComponent(int componentIndex) { GameObject blade = Instantiate(BladeComponents[componentIndex], transform.parent); blade.tag = "IntakeSource"; blade.transform.localPosition = transform.localPosition; blade.transform.localRotation = transform.localRotation; IntakeGenerator ig = blade.AddComponent <IntakeGenerator>(); ig.itype = Intake.IntakeType.DAMAGE; //can be phys, ice, fire, or chaos or pure i geuss cus we have no mitigation ig.iclass = Intake.IntakeClass.PHYSICAL; //random this, based of rarity common = 17.5 - 22.5, uncommon = 20-25, rare = 22.5-27.5, epic = 25-30, leggo = 27.5 - 32.5 //for each line in the file float ranval = Random.value; for (; rarity < RarityProbabilities.Length; rarity++) { ranval -= RarityProbabilities[rarity]; if (ranval <= 0) { break; } } ig.ammount = 17.5f + rarity * 2.5f + Random.Range(0f, 5f); return(blade.transform); }
public override void Start(RAIN.Core.AI ai) { base.Start(ai); anim = ai.Body.GetComponent <Animator>(); ig = ai.Body.GetComponentInChildren <IntakeGenerator>(); attacking = true; ig.active = true; anim.SetBool("Attack", attacking); }
public void SetJSON(JSONManager.EnemyJSON j) { m_stats = j; m_healthBar = gameObject.GetComponent <Health>(); m_healthBar.ownerClass = (Health.OwnerClass)m_stats.etype; m_healthBar.maxHealth = m_stats.hp; m_healthBar.currentHealth = m_stats.hp; IntakeGenerator i = gameObject.GetComponentInChildren <IntakeGenerator>(); i.ammount = m_stats.dmg; }
// Use this for initialization void Start() { RecursiveFillColliderList(skeletonRef); for (int i = 0; i < colliders.Count; i++) { colliders[i].isTrigger = true; CharacterColliderObject cco = colliders[i].transform.gameObject.AddComponent <CharacterColliderObject>(); cco.SetCTMParent(this); } if (weapon) { GameObject equipedWeapon = Instantiate(weapon, weaponHand); IntakeGenerator ig = equipedWeapon.GetComponent <IntakeGenerator>(); if (ig) { ig.buffManager = buffManager; equipedWeapon.layer = 10; } } }
public GameObject Generate(int hiltIndex, int guardIndex, int bladeIndex) { Destroy(sword); Transform blade = GenerateBladeComponent(bladeIndex); sword = blade.gameObject; GenerateHiltComponent(hiltIndex, blade); GenerateGuardComponent(guardIndex, blade); IntakeGenerator ig = blade.GetComponent <IntakeGenerator>(); float ranval = Random.value; for (; typeChance < ElementProbabilities.Length; typeChance++) { ranval -= ElementProbabilities[typeChance]; if (ranval <= 0) { break; } } //Chaos = 6, Fire = 4, Ice = 5,, Pure = 0, phys = 3 if (typeChance == 1) { ig.iclass = Intake.IntakeClass.PHYSICAL; } if (typeChance == 2) { ig.iclass = Intake.IntakeClass.CHAOS; } if (typeChance == 3) { ig.iclass = Intake.IntakeClass.FIRE; } if (typeChance == 4) { ig.iclass = Intake.IntakeClass.ICE; } if (typeChance == 5) { ig.iclass = Intake.IntakeClass.PURE; } //setting blade aura color to match rarity ~~ can we modified to match elemental type if (ig.iclass == Intake.IntakeClass.PHYSICAL) { AuraColor = new Vector4(50, 50, 50, 0.7f); } if (ig.iclass == Intake.IntakeClass.CHAOS) { AuraColor = new Vector4(4, 0, 50, 0.7f); } if (ig.iclass == Intake.IntakeClass.FIRE) { AuraColor = new Vector4(255, 0, 0, 0.7f); } if (ig.iclass == Intake.IntakeClass.ICE) { AuraColor = new Vector4(0, 255, 255, 0.7f); } if (ig.iclass == Intake.IntakeClass.PURE) { AuraColor = new Vector4(255, 255, 255, 0.7f); } bladeMat = sword.GetComponent <Renderer>().material; bladeMat.SetColor("_ColorR", AuraColor); bladeMat.SetColor("_Color2", AuraColor); playerCTM.weapon = ig.gameObject; ig.buffManager = playerBM; playerCTM.weapon.layer = 10; playerS.UpdateIG(ig); return(blade.gameObject); }
// Update is called once per frame void Update() { float home = Input.GetAxis("ControllerSelect"); if (home > 0.1f) { Destroy(GameObject.FindGameObjectWithTag("PlayerRoot")); Destroy(GameObject.FindGameObjectWithTag("MainCamera")); Destroy(GameObject.FindGameObjectWithTag("HUDCanvas")); Destroy(GameObject.FindGameObjectWithTag("JSONManager")); UnityEngine.SceneManagement.SceneManager.LoadScene("testscene"); return; } if (!ig) { ig = ctm.weaponHand.transform.GetComponentInChildren <IntakeGenerator>(); } AnimatorStateInfo animState = anim.GetCurrentAnimatorStateInfo(0); var camera = Camera.main; var forward = camera.transform.forward; var right = camera.transform.right; forward.y = 0f; right.y = 0f; forward.Normalize(); right.Normalize(); //Character Movement //getting input from controller left stick inputH = Input.GetAxis("LeftStickHorizontal"); inputV = Input.GetAxis("LeftStickVertical"); Vector2 input = new Vector2(inputH, inputV); if (input.magnitude < 0.1f) { inputH = inputV = 0; } attacc = Input.GetButtonDown("Fire3");//get x button press //attackPressTimer -= Time.deltaTime; //if (attacc) // attackPressTimer = 1; //if (attackPressTimer < 0) // attacc = false; //else // attacc = true; rollyPolly = Input.GetButtonDown("Fire2"); // get b button press if (attacc) { if (attaccPhase < 3) { attaccPhase++; } else { attaccPhase = 1; } } //animator setting values anim.SetFloat("inputH", inputH); anim.SetFloat("inputV", inputV); anim.SetBool("attacc", attacc); anim.SetInteger("attaccPhase", attaccPhase); anim.SetBool("rollyPolly", rollyPolly); //print(anim.GetCurrentAnimatorStateInfo(0).tagHash); //invuln on roll if (animState.tagHash == -1061482972) { BuffManager.Invulnerability invuln = new BuffManager.Invulnerability(); invuln.startDuration = 0.1f; bm.AddBuff(invuln); } //enable the swords intake (do damage) if (animState.tagHash == 1080829965) { ig.active = true; } else { ig.active = false; } Vector3 desiredMoveDir = -forward * inputV + right * inputH; if (desiredMoveDir.magnitude >= 0.3f) { transform.forward = desiredMoveDir.normalized; } transform.position += (desiredMoveDir * player_Speed * Time.deltaTime); //rbody movement // rbody.velocity = new Vector3(inputH *player_Speed * Time.deltaTime, 0.0f, inputV * -player_Speed * Time.deltaTime); //rotate char //transform.Rotate(0, Input.GetAxis("RightJoystickHorizontal") * DegreesPerSecond, 0); //lastAnim = animState; }
public void UpdateIG(IntakeGenerator _ig) { ig = _ig; }