Example #1
0
 public void AddToObjList(GameObject obj)
 {
     //if (!objs.Contains(obj)) objs.Add(obj);
     Enemy.Slime s = obj.GetComponent <Enemy.Slime>();
     if ((s.ColorData == color))
     {
         audio[0].Play();
         KRaB.Enemy.Colors.EnemyColor c = s.ColorData - color;
         if (c == (MonoBehaviour)null)
         {
             if (!Manager.GameMaster.Instance.isQuitting)
             {
                 if (Random.Range(0f, 1f) < healthDropRatio)
                 {
                     Instantiate(healthDropPrefab, obj.GetComponent <Transform>().position, GetComponent <Transform>().rotation);
                 }
             }
             Destroy(obj);
             return;
         }
         s.ColorData = c;
     }
     audio[1].Play();
     obj.GetComponent <Enemy.Slime>().ApplyRejectForce();
 }
Example #2
0
        public void ApplyShovelCurve(GameObject toShovel)
        {
            Enemy.Slime es = toShovel.GetComponent <Enemy.Slime>();
            es.launch(ref bucketTransform, curveTime, curveDampner);
            //toShovelTransform = toShovel.GetComponent<Transform>();

            // x = ((1-t)^3)*P0X + 3*((1-t)^2)*t*P1X + 3(1-t)*(t^2)*P2X + (t^3)*P3X
            // float timeRatio = (Time.time - currTime) / shovelCurveTime
            //Debug.Log("Shoveled");
            //CurveThrow thrw = new CurveThrow(ref bucketTrans, ref toShovelTrans, 5f);
            //toShovel.GetComponent<Rigidbody2D>().AddForce(new Vector2(facingRight ? 12f : -12f, 25), ForceMode2D.Impulse);
        }