Answer the question
In order to leave comments, you need to log in
Why does the class not see the variable?
There is an abstract class and inheriting from it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class Angles4
{
public Vector3 objpos;
public float step;
public Vector3 downleft;
public Vector3 downright;
public Vector3 upleft;
public Vector3 upright;
public Angles4(Vector3 _objpos, float _step = 1f)
{
this.objpos = _objpos;
this.step = _step;
}
public void ChangeStep(float _newstep)
{
this.step = _newstep;
}
public virtual void setdownleft()
{
downleft = new Vector3(Random.Range(objpos.x - step, objpos.x), Random.Range(objpos.y - step, objpos.x), objpos.z);
}
public abstract void setdownright();
public abstract void setupright();
public abstract void setupleft();
}
public class RectShape : Angles4
{
public RectShape(Vector3 _objpos, float _step) : base(_objpos, _step)
{
objpos = _objpos;
step = _step;
}
public override setdownleft()
{
downleft = new Vector3(objpos.x - step, objpos.y - step, objpos.z);
}
public override setdownright()
{
downright = new Vector3(objpos.x + step, objpos.y - step, objpos.z);
}
public override setupright()
{
upright = new Vector3(objpos.x + step, objpos.y + step, objpos.z);
}
public override setupleft()
{
downright = new Vector3(objpos.x - step, objpos.y + step, objpos.z);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question