示例#1
0
 private static void OnImage(Message msg, bool isEdited)
 {
     ImageEvent?.Invoke(new MessageEventArgs()
     {
         msg = msg, isEdited = isEdited
     });
 }
    public void ResolveAttack()
    {
        if (GameManager.CurrentState != FightState.ConfrontState)
        {
            return;
        }

        if (Player1.ChosenAttacks.Count == 0)
        {
            GameManager.ConfrontIsOver();
            return;
        }

        Attack attack1 = Player1.ChosenAttacks.Dequeue();
        Attack attack2 = Player2.ChosenAttacks.Dequeue();

        AttackAnimation anim1 = Player1.ChosenAttacksAnim.Dequeue();
        AttackAnimation anim2 = Player2.ChosenAttacksAnim.Dequeue();

        Move1Started.Invoke(attack1.Image);
        Move2Started.Invoke(attack2.Image);

        if (attack1.Fervor != attack2.Fervor)
        {
            Player1.Fervor.Value += attack1.Fervor - attack2.Fervor;
            Player2.Fervor.Value += attack2.Fervor - attack1.Fervor;
        }

        anim1.StartAnimation(Attack1EndStatus);
        Player1.GetComponentInChildren <Animator>().SetTrigger(anim1.triggerName);

        anim2.StartAnimation(Attack2EndStatus);
        Player2.GetComponentInChildren <Animator>().SetTrigger(anim2.triggerName);


        result1.Reset();
        result2.Reset();

        Attack1EndStatus.Value = false;
        attack1.ResolveAttack(Player1, Player2, attack2, result1, result2);

        Attack2EndStatus.Value = false;
        attack2.ResolveAttack(Player2, Player1, attack1, result2, result1);


        CreatePopups();


        if (Player1.Population.Value <= 0)
        {
            GameManager.CallGameOver(Player2);
        }
        if (Player2.Population.Value <= 0)
        {
            GameManager.CallGameOver(Player1);
        }
    }
示例#3
0
    private IEnumerator ProcessImageRequest(string endpoint, ImageEvent onSuccess)
    {
        using (UnityWebRequest www = UnityWebRequest.GetTexture(imageBaseUri + endpoint + baseArgs, true)) {
            yield return(www.Send());

            //if(www.isNetworkError || www.isHttpError) {
            if (www.isError)
            {
                onError.Invoke(www.error);
            }
            else
            {
                onSuccess.Invoke(DownloadHandlerTexture.GetContent(www));
            }
        }
    }
示例#4
0
    void Update()
    {
        if (Session.Status != SessionStatus.Tracking)
        {
            return;
        }

        Session.GetTrackables <AugmentedImage>(tempAugmentedImages, TrackableQueryFilter.Updated);
        foreach (AugmentedImage image in tempAugmentedImages)
        {
            DBIndexToIsFound.TryGetValue(image.DatabaseIndex, out bool isFound);
            if (image.TrackingState == TrackingState.Tracking && isFound == false)
            {
                DBIndexToIsFound[image.DatabaseIndex] = true;
                ImageDetected.Invoke(image);
            }
            else if (image.TrackingState == TrackingState.Stopped && isFound == true)
            {
                DBIndexToIsFound[image.DatabaseIndex] = false;
                ImageLost.Invoke(image);
            }
        }
    }
示例#5
0
 public void TrigerImageEvent(object sender, ImageEventArgs e)
 {
     ImageEvent?.Invoke(sender, e);
 }