protected override TargetTemplate InferTemplate(TypeResolver res, IWarningLogger log) { TargetTemplate tmpl = null; string dtname = DirectTransformDep; if (dtname != null) { if (res.TryMatch(dtname, MatcherKind.DirectTransform, out tmpl, log)) { return(null); } if (tmpl != null) { return(tmpl); } } if (Rule == null) { if (res.TryMatch(Name, MatcherKind.Target, out tmpl, log)) { return(null); } } if (tmpl == null) { log.Error(2028, "Cannot guess the template or rule for this target", FullName); } return(tmpl); }
public override bool ResolveName(string name, out TargetTemplate tmpl, IWarningLogger log) { tmpl = null; Type t; if (ResolveType(name, out t, log)) { return(true); } if (t.IsSubclassOf(typeof(Rule))) { Type t2 = TemplateForRule(t, log); if (t2 == null) { // So yeah this is kinda dumb namespacing. tmpl = new Mono.Build.RuleLib.RegexMatcher.RuleOnlyTemplate(t); return(false); } t = t2; } if (!t.IsSubclassOf(typeof(TargetTemplate))) { string s = String.Format("Type {0} (resolved from {1}) should be a TargetTemplate but isn't", t.FullName, name); log.Error(2022, s, null); return(true); } object o; if (InstantiateBoundType(t, out o, log)) { return(true); } tmpl = (TargetTemplate)o; return(false); }
/// <summary> /// Get hits for a template /// </summary> public void TemplateHit(AbilityActivator ab, TargetTemplate template, int range, Hexagon source, Hexagon destination) { Template t = templates [(int)template].GetComponentInChildren <Template> (); t.GetHits(ab, range, source, destination); }