August 2018
Beginner
334 pages
10h 19m
English
In order to illustrate how to develop child classes deriving from the Condition function, let's take a look at a couple of examples; one that is aimed at validating a value in a range, the other at being a logic comparer between two conditions:
The code for ConditionFloat is as follows:
using UnityEngine;
using System.Collections;
public class ConditionFloat : Condition
{
public float valueMin;
public float valueMax;
public float valueTest;
public override bool Test()
{
if (valueMax >= valueTest && valueTest >= valueMin)
return true;
return false;
}
}
The following code is an example of code for ConditionAnd:
using UnityEngine; using System.Collections; public class ConditionAnd : Condition { public Condition conditionA; ...Read now
Unlock full access