void Start()
 {
     timer = GameObject.FindObjectOfType<Timer>();
     magnet = GameObject.FindObjectOfType<MagnetComponent>();
     crateSpawner = GameObject.FindObjectOfType<CrateSpawner>();
     indicators = new Image[]
     {
         indicator0,
         indicator1,
         indicator2,
         indicator3,
         indicator4
     };
     opaqueColor = new Color(1, 1, 1, 1);
     transparentColor = new Color(1, 1, 1, 0.3f);
     foreach(Image image in indicators)
         image.color = transparentColor;
 }
Beispiel #2
0
    public void Execute()
    {
        foreach (Entity e in _group.GetEntities())
        {
            Entity target = e.followTarget.target;
            if (target != null)
            {
                Vector2         targetPosition  = target.position.pos;
                MagnetComponent magnetComponent = e.magnet;
                Vector2         position        = e.position.pos;

                if (isPointInCircle(targetPosition.x, targetPosition.y, magnetComponent.radius, position.x, position.y))                   // todo it's calculating all, view seperation in quads?
                {
                    VelocityComponent velocity = e.velocity;
                    velocity.vel.Set((targetPosition.x - position.x) * 5.0f, (targetPosition.y - position.y) * 5.0f);
                }
            }
        }
    }
 void Start()
 {
     pulleyTransform = GameObject.Find("Pulley").transform;
     prePulleyTransform = GameObject.Find("PrePulley").transform;
     magnetComponent = GameObject.FindObjectOfType<MagnetComponent>();
 }