Beispiel #1
0
 public void EndDialog()
 {
     print("Dialog -" + gameObject.name + "- ended");
     DialogDisplayer.s.SetDialogScreenState(false);
     //print ("note that this doesnt actually stop the dialog, this is just a reminder that the dialogue ended");
     callWhenDone.Invoke();
 }
Beispiel #2
0
 public void hurt()
 {
     if (underAttack == null)
     {
         hurtEvent.Invoke();
         print("hurt" + lastNum);
         myInfo.healthPoint -= 1;
         int temp = lastNum;
         for (int i = lastNum; i < disappear.Count; i++)
         {
             if (lastNum - temp > 10)
             {
             }
             else
             {
                 lastNum++;
                 disappear [i].material = dis;
             }
         }
         if (myInfo.healthPoint < 0)
         {
             Die();
         }
         StopCoroutine(behaviourCor);
         underAttack = StartCoroutine(escape());
     }
 }
Beispiel #3
0
	void OnTriggerEnter2D(Collider2D col)
	{
		if (col.CompareTag ("Player")) 
		{
		for (int i = 0; i < cond.Length; i++) {
			if (!cond [i].activeInHierarchy) {
				allActive = false;
				break;
			}
		}

		if (allActive&&doit!=null) {
			doit.Invoke ();
		}
	}
}
Beispiel #4
0
    public void StartDialog()
    {
        print("Dialog -" + gameObject.name + "- started");
        dialogs [0].StartDialog();
        DialogDisplayer.s.SetDialogScreenState(true);

        callWhenBegin.Invoke();
    }
Beispiel #5
0
    public void EndDrawing()
    {
        if (startDrawing)
        {
//			thisTurnLine.GetComponent<type_line> ().donePainting = true;
            thisTurnLine = null;
            count        = 0;
            startDrawing = false;
            endPainting.Invoke();
        }
    }
Beispiel #6
0
    public void Die()
    {
//		print ("here DIE");
        DieEvent.Invoke();
        foreach (GameObject obj in dots)
        {
            obj.SetActive(false);
            obj.transform.SetParent(null);
        }
        dots.Clear();
        gameObject.SetActive(false);
    }
 void Update()
 {
     if (UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject == this.gameObject)
     {
         if (navigateOnCancel)
         {
             if (Input.GetButtonDown("Cancel"))
             {
                 UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(navigateTo);
                 OnEvent.Invoke();
             }
         }
         else
         {
             if (Input.GetButtonDown("Submit"))
             {
                 UnityEngine.EventSystems.EventSystem.current.SetSelectedGameObject(navigateTo);
                 OnEvent.Invoke();
             }
         }
     }
 }
Beispiel #8
0
 public void Drawing()
 {
     if (!startDrawing)
     {
         count        = 1;
         startDrawing = true;
         lineInit();
     }
     else
     {
         count += 1;
         if (count % createInterval == 0)
         {
             lineBuilding();
         }
         startPainting.Invoke();
     }
 }
Beispiel #9
0
    void preAtk()
    {
        Ray        ray    = new Ray(transform.position, transform.forward);
        RaycastHit rayhit = new RaycastHit();

        //atkAni.SetFloat ("speed", 0);
        if (Physics.Raycast(ray, out rayhit, 1000f, hitTHis))
        {
//			print (rayhit.point);
//			projectionObj.transform.position = rayhit.point;
//			projectionObj.transform.LookAt (playerPosition);
//			projectionObj.SetActive (true);
            atkType = createInProportion();
        }
        Material thisMat = type_general.thisGeneral.findMat(atkType);

        changeMat(thisMat);
        preAttackEvent.Invoke();
    }
Beispiel #10
0
 void Start()
 {
     gm = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <GameMaster>();
     foreach (string strin in gm.did)
     {
         if (strin == chek)
         {
             if (sensitive)
             {
                 action.Invoke();
             }
             if (!depend)
             {
                 player.position = pt.position;
             }
             depend = false;
         }
     }
     if (depend)
     {
         Destroy(gameObject);
     }
 }
    void FixedUpdate()
    {
        //if mouse button (left hand side) pressed instantiate a raycast
        if (Input.GetMouseButtonDown(0))
        {
            //create a ray cast and set it to the mouses cursor position in game
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100))
            {
                //draw invisible ray cast/vector
                Debug.DrawLine(ray.origin, hit.point);
                //log hit area to the console
                Debug.Log(hit.point);

                lastHit = hit.collider.gameObject;

                hitOffset = hit.collider.transform.position - hit.point;

                OnEvent.Invoke();
            }
        }
    }
Beispiel #12
0
 public void Die()
 {
     dieEvent.Invoke();
     print("enemy DIE");
 }
 public void OnTriggerRight()
 {
     triggerRightTouchBut.Invoke();
 }
Beispiel #14
0
    void atk()
    {
        attackEvent.Invoke();
        agent.destination = playerPosition.position;
//		projectionObj.SetActive (false);
    }
 public void OnTriggerMenuBut()
 {
     triggerMenuBut.Invoke();
 }
Beispiel #16
0
 public void OnLeave()
 {
     exit.Invoke();
 }
 public void EndTriggerGripBut()
 {
     exitGripBut.Invoke();
 }
 public void OnTriggerUp()
 {
     triggerUpTouchBut.Invoke();
 }
Beispiel #19
0
    void Update()
    {
        //check if we have achieved the objective or not
        //if yes then call events
        foreach (Objective myObjective in objectives)
        {
            float value         = myObjective.myObjectiveChecker.GetValue();
            float requiredValue = myObjective.requiredValue;

            switch (myObjective.type)
            {
            case Objective.conditionType.ifTrue:
                if (value == 1)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifFalse:
                if (value == 0)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifAll:
                if (value == requiredValue)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifAny:
                if (value > 0)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifLessThan:
                if (value < requiredValue)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifLessThanOrEqual:
                if (value <= requiredValue)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifMoreThan:
                if (value > requiredValue)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifMoreThanOrEqual:
                if (value >= requiredValue)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;

            case Objective.conditionType.ifEqual:
                if (value == requiredValue)
                {
                    CallEvent(myObjective);
                    myObjective.isDone = true;
                }
                else
                {
                    myObjective.isDone = false;
                }
                break;
            }
        }

        if (IsAllDone())
        {
            callWhenAllIsDone.Invoke();
        }
    }
 public void EndTriggerMenuBut()
 {
     exitMenuBut.Invoke();
 }
 public void EndTriggerTouchBut()
 {
     exitTouchBut.Invoke();
 }
 public void EndTriggerTriggerBut()
 {
     exitTriggerBut.Invoke();
 }
 public void OnTriggerTriggerBut()
 {
     triggerTriggerBut.Invoke();
 }
 public void OnTriggerLeft()
 {
     triggerLeftTouchBut.Invoke();
 }
Beispiel #25
0
 public void OnClick()
 {
     stay.Invoke();
 }
 public void OnTriggerDown()
 {
     triggerDownTouchBut.Invoke();
 }
Beispiel #27
0
 public void OnTrigger()
 {
     trigger.Invoke();
 }
Beispiel #28
0
 public void OnInputClicked(InputClickedEventData eventData)
 {
     OnEvent.Invoke();
 }
 public void OnTriggerGripBut()
 {
     triggerGripBut.Invoke();
 }