Exemplo n.º 1
0
Arquivo: But.cs Projeto: sylafrs/rugby
 public override void Left(Triggered t)
 {
     Ball b = t.GetComponent<Ball>();
     if (b != null){
         b.Game.OnConversion(this);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (SecondSound != null && FirstSound != null)
     {
         if (transition == Triggered.SecondSound)
         {
             if (SecondSound.volume < 1)
             {
                 SecondSound.volume += Time.deltaTime * TransitionSpeed;
                 FirstSound.volume -= Time.deltaTime * TransitionSpeed;
             }
             if (SecondSound.volume >= 1)
             {
                 SecondSound.volume = 1;
                 FirstSound.volume = 0;
                 transition = Triggered.NotTriggered;
             }
         }
         else if (transition == Triggered.FirstSound)
         {
             if (FirstSound.volume < 1)
             {
                 FirstSound.volume += Time.deltaTime * TransitionSpeed;
                 SecondSound.volume -= Time.deltaTime * TransitionSpeed;
             }
             if (FirstSound.volume >= 1)
             {
                 FirstSound.volume = 1;
                 SecondSound.volume = 0;
                 transition = Triggered.NotTriggered;
             }
         }
     }
 }
Exemplo n.º 3
0
    public override void Entered(Triggered t)
    {
        Ball ball = t.GetComponent<Ball>();
        if (ball != null)
        {
            Game.instance.OnTouch(this);
            //Game.instance.Referee.OnTouch(this);

            //ball.inTouch = this;

            //if (ball.Game.state == Game.State.PLAYING)
            //{
                //this.gameObject.SendMessageUpwards("OnTouch", this, SendMessageOptions.DontRequireReceiver);
            //}
            /*
            else if(ball.Game.state == Game.State.TRANSFORMATION)
            {
                TransformationManager tm = ball.Game.GetComponent<TransformationManager>();
                if (tm)
                    tm.OnLimit();
                else
                    Debug.LogWarning("Error : I dont find Transformation Manager in the Game");
            }
            */
        }
    }
Exemplo n.º 4
0
 public override void Entered(Triggered t)
 {
     Ball b = t.GetComponent<Ball>();
     if (b != null)
     {
         game.OnBallOut();
     }
 }
Exemplo n.º 5
0
    public override void Entered(Triggered o)
    {
        Debug.Log("Entrée dans la zone de "+o.name);
        Ball b = o.GetComponent<Ball>();

        if(o.GetType() == typeof(Unit)){
            Unit u = (Unit)o;
            u.isInTryZone = true;
            //u.ShowButton("A");
        }

        if (b != null)
        {
            b.Owner.ShowButton("A");
            b.inZone = this;
        }
    }
 void OnTriggerExit2D(Collider2D _other)
 {
     if (!Flip)
     {
         if (Player.transform.position.x < gameObject.transform.position.x)
             transition = Triggered.FirstSound;
         else
             transition = Triggered.SecondSound;
     }
     else
     {
         if (Player.transform.position.x > gameObject.transform.position.x)
             transition = Triggered.FirstSound;
         else
             transition = Triggered.SecondSound;
     }
 }
Exemplo n.º 7
0
    public override void Inside(Triggered o)
    {
        Ball b = o.GetComponent<Ball>();
        if (b != null && b.Owner != null && b.Owner.Team != this.Owner){
            if (b.Owner.Team.Player == null){
                b.Game.OnTry(this);
            }
            else{
                foreach(Unit u in b.Owner.Team) {
                    u.HideButton();
                }

                if(!b.Owner.ButtonVisible) {
                    b.Owner.ShowButton("A");
                }
            }
            if(b.Owner.isInTryZone == false){
                b.Owner.HideButton();
            }
        }
    }
Exemplo n.º 8
0
    public override void Left(Triggered o)
    {
        Debug.Log("Sortie de la zone "+this.name+" par "+o.name);
        Ball b = o.GetComponent<Ball>();

        if(o.GetType() == typeof(Unit)){
            Unit u = (Unit)o;
            u.isInTryZone = false;
            u.HideButton();
        }

        if (b != null)
        {
            b.inZone = null;
            Debug.Log("ball zone : "+b.inZone);
            foreach(Unit u in b.Team) {
                u.HideButton();
            }
            foreach(Unit u in b.Team.opponent) {
                u.HideButton();
            }
        }
    }
Exemplo n.º 9
0
 public virtual void Left(Triggered o)
 {
 }
Exemplo n.º 10
0
 public virtual void Inside(Triggered o)
 {
 }
Exemplo n.º 11
0
 public virtual void Entered(Triggered o)
 {
 }
Exemplo n.º 12
0
 public override void Entered(Triggered o, Trigger t)
 {
     if (t.GetType() == typeof(NearBall))
     {
         Unit u = o.GetComponent<Unit>();
         if (u != null)
         {
             u.sm.event_NearBall();
         }
     }
     else if (t.GetType() == typeof(ScrumField))
     {
         Unit u = o.GetComponent<Unit>();
         if (u != null)
         {
             if (!scrumFieldUnits.Contains(u))
                 scrumFieldUnits.Add(u);
         }
     }
 }
Exemplo n.º 13
0
 public override void Left(Triggered o, Trigger t)
 {
     if (t.GetType() == typeof(ScrumField))
     {
         Unit u = o.GetComponent<Unit>();
         if (u != null)
         {
             if (scrumFieldUnits.Contains(u))
                 scrumFieldUnits.Remove(u);
         }
     }
 }
Exemplo n.º 14
0
 public override void Inside(Triggered o, Trigger t)
 {
     Unit other = o.GetComponent<Unit>();
     if (other != null)
     {
         if (t.GetType() == typeof(NearUnit))
         {
             if (other.Team != this.Team)
                 this.sm.event_NearUnit(other);//
         }
     }
 }
Exemplo n.º 15
0
 public override void Left(Triggered o, Trigger t)
 {
     Unit other = o.GetComponent<Unit>();
     if (other != null)
     {
         if (t.GetType() == typeof(NearUnit))
         {
             if (NearUnits.Contains(other))
             {
                 NearUnits.Remove(other);
             }
         }
         if (t.GetType() == typeof(RangeUnit))
         {
             if (RangeUnits.Contains(other))
             {
                 RangeUnits.Remove(other);
             }
         }
     }
 }
Exemplo n.º 16
0
 public override void Entered(Triggered o, Trigger t)
 {
     Unit other = o.GetComponent<Unit>();
     if (other != null)
     {
         if (t.GetType() == typeof(NearUnit))
         {
             if (other.Team != this.Team)
             {
                 if (!NearUnits.Contains(other))
                 {
                     NearUnits.Add(other);
                 }
             }
         }
         if (t.GetType() == typeof(RangeUnit))
         {
             if (other.Team != this.Team)
             {
                 if (!RangeUnits.Contains(other))
                 {
                     RangeUnits.Add(other);
                 }
             }
         }
     }
 }
Exemplo n.º 17
0
 public virtual void Entered(Triggered o, Trigger t)
 {
     if (o == this) Entered(t);
 }
Exemplo n.º 18
0
 public virtual void Left(Triggered o, Trigger t)
 {
     if (t == this) Left(o);
 }
Exemplo n.º 19
0
 public virtual void Inside(Triggered o, Trigger t)
 {
     if (o == this) Inside(t);
 }
Exemplo n.º 20
0
 public virtual void Left(Triggered o, Trigger t)
 {
     if (o == this) Left(t);
 }