public void Academy_Initialize()
    {
        print("Initializing Enemy System");
        characterPlacement = GameObject.FindObjectOfType <GameSystem>();

        levelData = Resources.Load("Level data") as LevelData;
        level     = PlayerPrefs.GetInt("level");
        inspector = new UnitInspect(characterPlacement);
    }
    public void initRefer(dynamic obj)
    {
        Debug.Log("Greetings from refer");
        GiveBrain(obj.AgnetBrain);
        lives                 = obj.lives;
        damage                = obj.damage;
        attackTag             = obj.attackTag;
        ragdoll               = obj.ragdoll;
        Hitbox                = obj.Hitbox;
        attackAudio           = obj.attackAudio;
        runAudio              = obj.runAudio;
        maxStopSeconds        = obj.maxStopSeconds;
        VectorMagnitude       = obj.VectorMagnitude;
        DeprecatedAttackRange = obj.DeprecatedAttackRange;
        DamagedParticle       = obj.DamagedParticle;
        HealedParticle        = obj.HealedParticle;
        float mag;

        VectorMagnitude = (obj.Param.TryGetValue("AngularMoveMagnitude", out mag))?mag:VectorMagnitude;
        Debug.Log("Set parameters passed");
        initplus(obj);
        innerInitializeAgent();

        sys        = GameObject.FindObjectOfType <GameSystem>();
        PlannedObs = sys.initKnightNumber + sys.initEnemyNumber;
        source     = GetComponent <AudioSource>();
        agent      = this.GetComponent <NavMeshAgent>();
        animator   = this.GetComponent <Animator>();

        /*
         * health = transform.Find("Health").gameObject;
         * healthbar = health.transform.Find("Healthbar").gameObject;
         * health.SetActive(false);
         * healthbar.GetComponent<Slider>().maxValue = lives;
         */
        //get default stopping distance
        defaultStoppingDistance = agent.stoppingDistance;
        //if there's a dust effect, find and assign it
        if (transform.Find("dust"))
        {
            dustEffect = transform.Find("dust").gameObject.GetComponent <ParticleSystem>();
        }

        //find the area so the character can walk around
        area          = GameObject.FindObjectOfType <WalkArea>();
        inspector     = new UnitInspect(sys);
        lastLives     = lives;
        startLives    = lives;
        lastTime      = -maxStopSeconds;
        inspector.cam = FindObjectOfType <CamController>();
        DebugInner    = new DebugInfo(inspector);
        isPassedInit  = true;
    }
Exemple #3
0
    public override void InitializeAcademy()
    {
        //Monitor.SetActive(true);

        sys = FindObjectOfType <GameSystem>();
        //enemysys=FindObjectOfType<EnemyArmy>();
        inspector     = new UnitInspect(sys);
        inspector.cam = FindObjectOfType <CamController>();

        sys.Academy_Initialize();
        //enemysys.Academy_Initialize();
    }
Exemple #4
0
 //录入单位考察信息
 public void Insert(UnitInspect unitInspect)
 {
     try
     {
         dbcontext.UnitInspectContext.Add(unitInspect);
         dbcontext.SaveChanges();
     }
     catch (System.Data.SqlClient.SqlException e)
     {
         throw;
     }
 }
    void Start()
    {
        //get start rotation
        Vector3 rot = transform.localRotation.eulerAngles;

        rotationY = rot.y;
        rotationX = rot.x;

        //find the character placer
        characterPlacer = GameObject.FindObjectOfType <GameSystem>();
        inspector       = new UnitInspect(characterPlacer);
        DebugInner      = new DebugInfo(inspector);
    }
    void Start()
    {
        //if this an archer or enemy, don't use the spread option
        if (GetComponent <Archer>() || this.tag == "Enemy")
        {
            spread = false;             //spread the alley
        }
        Academy = GameObject.FindObjectOfType <GameSystem>();
        //print(Academy);
        //get the audio source
        source            = GetComponent <AudioSource>();
        maxAlliesPerEnemy = 1;

        //find navmesh agent component
        agent    = this.GetComponent <NavMeshAgent>();
        animator = this.GetComponent <Animator>();

        /*
         * //find objects attached to this character
         * health = transform.Find("Health").gameObject;
         * healthbar = health.transform.Find("Healthbar").gameObject;
         * health.SetActive(false);
         */
        lastLives = lives;
        //set healtbar value
        //healthbar.GetComponent<Slider>().maxValue = lives;
        startLives            = lives;
        Academy.AllInitLives += lives;
        //get default stopping distance
        defaultStoppingDistance = agent.stoppingDistance;

        //if there's a dust effect, find and assign it
        if (transform.Find("dust"))
        {
            dustEffect = transform.Find("dust").gameObject.GetComponent <ParticleSystem>();
        }

        //find the area so the character can walk around
        area            = GameObject.FindObjectOfType <WalkArea>();
        inspector       = new UnitInspect(Academy);
        inspector.cam   = FindObjectOfType <CamController>();
        rnd             = new System.Random();
        HitboxComponent = Hitbox.GetComponent <HitboxScript>();
        isPassedInit    = true;
        if (!Academy.showanim)
        {
            animator.enabled = false;
        }
    }
Exemple #7
0
 //根据UnitInspectID删除单位考察信息
 public int Delete(int unitInspectID)
 {
     try
     {
         // Files file = dbcontext.FilesContext.Where(u => u.FilesID == filesID).FirstOrDefault();
         UnitInspect unitInspect = dbcontext.UnitInspectContext.Where(u => u.UnitInspectID == unitInspectID).FirstOrDefault();
         int         attachid    = Convert.ToInt32(unitInspect.AccessoryID);
         dbcontext.UnitInspectContext.Attach(unitInspect);
         dbcontext.UnitInspectContext.Remove(unitInspect);
         return(attachid);
     }
     catch
     {
         throw;
     }
 }
Exemple #8
0
 //改变审核状态
 public bool ChangePass(int inspect, bool ispass)
 {
     try
     {
         UnitInspect ins = dbcontext.UnitInspectContext.Find(inspect);
         if (ins == null)
         {
             return(false);
         }
         ins.IsPass = ispass;
         dbcontext.SaveChanges();
         return(true);
     }
     catch (System.Data.SqlClient.SqlException e)
     {
         throw e;
     }
 }
Exemple #9
0
 //更新
 public void Update(UnitInspect unitInspect)
 {
     try
     {
         UnitInspect ins = dbcontext.UnitInspectContext.Find(unitInspect.UnitInspectID);
         ins.VisitContent = unitInspect.VisitContent;
         ins.WorkPlace    = unitInspect.WorkPlace;
         ins.SecrecyLevel = unitInspect.SecrecyLevel;
         ins.IsPass       = unitInspect.IsPass;
         ins.InspectTime  = unitInspect.InspectTime;
         ins.InspectName  = unitInspect.InspectName;
         ins.EntryPerson  = unitInspect.EntryPerson;
         ins.Duty         = unitInspect.Duty;
         ins.AgencyID     = unitInspect.AgencyID;
         ins.AccessoryID  = unitInspect.AccessoryID;
         dbcontext.SaveChanges();
     }
     catch (System.Data.SqlClient.SqlException e)
     {
         throw e;
     }
 }
Exemple #10
0
    public override void RewardAtEpisodeEnds(UnitInspect inspector, GameSystem sys)
    {
        float AllDamaged = (inspector.getCurrentEnemys().Length <= 0)?0:inspector.AvgLives(inspector.getCurrentEnemys());

        //Rewarding globally
        foreach (GameObject knight in inspector.getInstantiatedKnights())
        {
            inspector.setScriptsFrom(knight);
            if (inspector.isScriptValid() && inspector.getScriptType() == "AgentScript")
            {
                BagReset();
                AddReward((1 - ((AllDamaged) / sys.AllInitLives)) * 2f);
                Apply(inspector.AgentScript);
            }
        }

        /*
         * //Rewarding reamined units
         * foreach(GameObject knight in inspector.getCurrentKnights()) {
         *  inspector.AgentAddRewardDircetly(1f);
         * }
         */
    }
Exemple #11
0
    ///<summary>Initializing system varables.</summary>
    public void Academy_Initialize()
    {
        print("Initializing Game System");
        levelData = Resources.Load("Level data") as LevelData;
        //double the grid size so it's always even
        gridSize   = levelData.gridSize * 2;
        gridCenter = GameObject.FindObjectOfType <EnemyArmy>().gameObject.transform.position;
        //get the grid center by taking the opposite of the the enemy army position
        gridCenter = new Vector3(-gridCenter.x, gridCenter.y, gridCenter.z);

        //if the level exists, show some level info, else load the end screen
        if (PlayerPrefs.GetInt("level") >= levelData.levels.Count)
        {
            Debug.LogError("Invalid level data, Load default level - " + PlayerPrefs.GetInt("level"));
            PlayerPrefs.SetInt("level", 0);
        }
        else
        {
            levelInfo.text = "Level " + (PlayerPrefs.GetInt("level") + 1) + " - " + levelData.levels[PlayerPrefs.GetInt("level")].scene;
        }
        characterStats = true;
        switchPanelContent(false);
        characterStatsPanel.SetActive(false);
        //enables minimap
        topDownMapPanel.SetActive(true);
        leftPanelAnimator.SetBool("hide instant", true);

        EmptyUnit = new GameObject();
        EmptyUnit.transform.parent = this.gameObject.transform;
        inspector     = new UnitInspect(this);
        cam           = FindObjectOfType <CamController>();
        inspector.cam = cam;
        DebugInner    = new DebugInfo(inspector);
        AcademyInner  = FindObjectOfType <MyAcademy>();
        area          = FindObjectOfType <WalkArea>();
    }
 public DebugInfo(UnitInspect inspector)
 {
     this.i = inspector;
 }
 public virtual void RewardAtEpisodeEnds(UnitInspect inspector, GameSystem sys)
 {
 }