public void Interact(GameObject player) { /** * Adds the bouncers velocity to the player on contact */ if (disableTime <= 0) { audsrc.PlayOneShot(bounceSound, 0.5f); PlayerScript ps = player.GetComponent <PlayerScript>(); BottleScript bs = player.GetComponent <BottleScript>(); // Bounce player if (ps != null) { ps.transform.position = bounce_offset; ps.AddVelocity(deltav); ps.UnStun(); disableTime = 0.1f; animator.SetTrigger("bounce"); } // Bounce bottle if (bs != null) { bs.transform.position = bounce_offset; bs.AddVelocity(deltav); disableTime = 0.1f; animator.SetTrigger("bounce"); } } }
// Use this for initialization void Start() { rd = gameObject.GetComponent <Rigidbody2D> (); bottleSc = bottle.GetComponent <BottleScript> (); anim = gameObject.GetComponent <Animator> (); objCol = GetComponent <Collider2D> (); collWithPlayer = false; }
// Use this for initialization void Start() { cc = GetComponent <BoxCollider2D>(); ps = GetComponent <PlayerScript>(); bs = GetComponent <BottleScript>(); ec = GetComponent <EnemyClass>(); collision.reset(); bounds.initRay(cc); }
public static bool AddToMaster(BottleScript b) { if (instance == null) { Debug.LogWarning(b.name + " was not logged"); return(false); } instance.items.Add(b); return(true); }
public void Hurt(BottleScript bs) { StartCoroutine("showBossHurt"); if (timer > 0) { return; } Debug.Log("OUCH"); bs.Break(); health--; timer = gapTime; if (health == 0) { Die(); } else { animator.SetTrigger("damage"); } }
void TakeStone() { if (IsStone) { bottlescript.isDrag = false; IsStone = false; AiConeDetection.GroundMesh.SetActive(false); if (Bottle != null) { ZTPool.Instance.ReleaseGo("Model/Weapons/Bottle", Bottle, EPoolObjectType.PEntity); } } else { Bottle = ZTPool.Instance.GetGo("Model/Weapons/Bottle"); bottlescript = Bottle.GET <BottleScript>(); bottlescript.isDrag = true; bottlescript.actor = this; IsStone = true; AiConeDetection.GroundMesh.SetActive(true); } }
public void StartGame() { if (firstGame == 1) { InfoText.SetActive(false); } else if (firstGame == 0) { InfoText.SetActive(true); } Shop.SetActive(false); bottle = FindObjectOfType <BottleScript>(); currentFillLine = GameObject.Find("FillmentLine"); PourAnimGO.SetActive(false); HighScoreTxtGO.SetActive(false); endScreenOverlayPanel.SetActive(false); goalFillLineAnim.SetBool("LineSlideOut", true); if (FindObjectOfType <BottleScript>() != null) { PourAnimGO.GetComponent <Image>().color = bottle.liquidColor; // Set random position for the fill line the user has to reach. goalFillLine.transform.localPosition = new Vector3(-100, Random.Range(bottle.minAmount, bottle.maxAmount), 0); } //Get random dispense speed. SetDispenseSpeed(); fingerReleased = false; }